JavaScript Functions > Virtual Table Server Functions for Single Connection (lrvtc) > Alphabetical Listing of Virtual Table Server Functions (Single Server) > lrvtc.sendIfUnique

lrvtc.sendIfUnique

Sets the last field of a column to a value if the value does not exist in the column.

Example Data Update Functions

Syntax

lrvtc.sendIfUnique ( columnname, value );

Arguments

name Comments
columnName The name of the column.
value The string to write to the field.

lrvtc.sendIfUnique sets the last field of a column to a value if the value does not exist in the column. If the value already exists in the column, the function has no effect.

If a column is not indexed, the time required to execute a lrvtc.sendIfUnique call increases with the number of rows. If the column is indexed, the time for 'send if unique' operations is constant. For large databases, we recommend that you index columns you want to perform 'send if unique' operations on. See lrvtc.ensureIndex

Return Values

Returns zero on success or one of the Error Codes.

Parameterization

All string input arguments can be passed using standard parameterization.

Example

    var rc;
    ...
    rc = lrvtc.sendIfUnique("Default_Answer", "42");
    lr.logMessage("Send if unique rc="+ rc);