Thursday, December 29, 2011

Update Records of Table With While Loop

If we have to update the records of the table one by one we should have to follow the syntax as below:

1. Get the records from the tables
2. Start While loop with the table
3.Write code to update the record (Or anything you have to with record)
4.At the End of While Loop Next TableName.
----------------------------------------------------------------------------
Syntax:

tablename = get records form table

while(tablename)
{
    tablename.fieldname=value;
   
    tablename.Update();

    Next Tablename;
}
------------------------------------------------------------------------------
Example:

salesTable  = SalesTable::custOpenOrders(this.AccountNum,true);
while (salesTable)
{
        if (salesTable.CurrencyCode == origCurrencyCode)
        {
            salesTable.convertCurrencyCode(this.Currency);
            salesTable.update();
        }
        next salesTable;
}

No comments:

Post a Comment