Accessors for class IliTableBuffer

Properties

Methods

Description

A IliTableBuffer object is needed in order to manipulate the rows of a table object. You need a table buffer when you want to:
You first obtain a table buffer by calling the table's getBuffer method. Then the table buffer contains value objects, one for each column of the table to which the table buffer belongs. (See IliTableBufferValue class for more information.)
     var buffer = table.getBuffer();

These value objects are properties of the table buffer so that they can be accessed using the dot notation.
     var valueObjectID =  buffer.ID;
     var valueObjectNAME =  buffer.NAME;

Each of these value objects holds:
When you assign explicitly a value, the value object becomes "modified". Conversely, when you call either the clear or rowToBuffer methods, all value objects in the table buffer become "not modified".
     var rowno = 2;
     buffer.rowToBuffer(rowno);
     writeln(valueObjectNAME.isModified()); // prints "false"
     valueObjectNAME.value = "Jones";
     writeln(valueObjectNAME.isModified()); // prints "true"

Once you have set up the values in the table buffer according to your needs, you can call one of the IliTable methods that take a table buffer as a parameter such as:
These methods will consider only the values that are marked as modified. All other values will be considered as unspecified. This feature is important when you work with SQL databases. You do not want the IliTable.updateRow method to send back to the database server all values in the row. Only the values that must be modified are sent to the database server.
So, the following code updates only column NAME and leaves column ID unchanged:
     table.updateRow(rowno, buffer);

Note that a table buffer obtained from one table can be used with any other table if both tables have the same number of columns and corresponding columns have the same data types in both tables. This lets you easily copy rows from one table to another. (See the description of the modifyAll method for an example.)

TypeNameDescriptionNotes
IntcolumnsCountContains the number of values in this table buffer. This is the same as the number of columns in the underlying table.read-only
IliTabletableContains the table to which this table buffer belongs.read-only
Voidclear()Sets all values to null and changes their state to "not modified".
IliTableBufferValuegetValue(String colname)Returns the value object that corresponds to column named colname or null if no such column exists in the underlying table.
IliTableBufferValuegetValueAt(Int colno)Returns the value object at position colno (in the underlying table) which must be >= 0 and < columnsCount. Returns null if colno is out of bounds.
BooleanisModified()Returns true if at least one value has been modified since the table buffer was obtained, since the last time the clear method was called, or the last time the rowToBuffer method was called, whichever is more recent.
BooleanisNull()Returns true if all values are null.
VoidmodifyAll()Changes the state of all value objects to "modified" as if they had been assigned, but leaves the values themselves unchanged. This is useful if you want to copy rows from one table to another as in the following code function:
     function CopyRows(tableA, tableB) {
        var buffer = tableA.getBuffer();
        for (var rowno = 0; rowno < tableA.rowsCount; ++rowno) {
             buffer.rowToBuffer(rowno);
             buffer.modifyAll();
             tableB.appendRow(buffer);
        }
     }

Without the call to modifyAll in this function, the buffer would not provide any values to the appendRow method since only modified values are taken into account by this method.
VoidrowToBuffer(Int rowno)Copies the values in the row rowno in the underlying table to the table buffer. In addition the state of the value in the table buffer is set to "not modified".