Accessing the values of the current row

At any time, a ULTable object is positioned at one of the following places.

  • Before the first row of the table.
  • On a row of the table.
  • After the last row of the table.

If the ULTable object is positioned on a row, you can use one of the ULTable get methods to get the value of each column for the current row.

Example

The following code fragment retrieves the value of three columns from the tCustomer ULTable object, and displays them in text boxes.

var colID, colFirstName, colLastName;
colID = tCustomer.schema.getColumnID( "id" );
colFirstName = tCustomer.schema.getColumnID( "fname" );
colLastName = tCustomer.schema.getColumnID( "lname" );
alert( tCustomer.getInt( colID ) );
alert( tCustomer.getString( colFirstName ) );
alert( tCustomer.getString( colLastName ) );

You can also use methods of ULTable to set values.

tCustomer.setString( colLastName, "Kaminski" );

By assigning values to these properties you do not alter the value of the data in the database.

You can assign values to the properties even if you are before the first row or after the last row of the table. You cannot, however, get values from the column. For example, the following code fragment generates an error.

tCustomer.moveBeforeFirst();
id = tCustomer.getInt( colID );