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

lrvtc.updateMessageIfequals

Replaces the data in a field if the current data equals a given value.

Example Data Update Functions

Syntax

lrvtc.updateMessageIfequals ( columnName, rowIndex , value, ifEqualValue );

Arguments

name Comments
columnName The column to write to.
rowIndex The number of the row. The first row has index 1.
value The value to set the field to.
ifEqualValue The value to compare the current value of the field to.

lrvtc.updateMessageIfequals writes the value to the field specified with the column name and row index if the value of the field when lrvtc.updateMessageIfequals is called is equal to the ifEqualValue. If the ifEqualValue and the field value match, the field value is overwritten.

Return Values

0: If API call was successful but value was not updated.

1: If API call was successful and value was updated.

On call failure, one of the Error Codes.

Parameterization

All string input arguments can be passed using standard parameterization.

Example

    var rc;
    ....
    rc =  lrvtc.updateMessageIfequals("P_status", 18, "out of stock","instock");
    lr.logMessage("update_message rc="+ rc);