Contents Hide
A record set may be likened to table in a scripted query, as the both contain rows of values.
rs = new RecordSet("TABLE4");
rs = new RecordSet("TABLE4", vectFieldInfo);
Note:
A newly created recordset will have no values in it, and thus if no records are to be returned by a read operation, should be returned as is.
Either method may be used to create a new RecordSet to the variable rs. The lower method incorporates the definition of FieldInfo. In both cases, the RecordSet must have a name which will be used with the Synchronisation Engine.
rs = new RecordSet("TABLE4");
// record operations to populate the result set ...
record = new Record();
record.add(/*...*/);
// ... to the empty RecordSet
rs.add(record);
Note:
TABLE4 is the name of the table which this script source is referencing in this script. It is used to within the synchronisation process and thus must be correct..
Records must be added in the order they are mapped to on BrightServer.
For more information on how to create records, see Record Examples
Once a vector of FieldInfo has been created, it can be passed to a record set with the setFieldInfo method or on the record set's instantiation. Doing this will ensure the data passed between the server and script is of the same type and thus read properly.
vectFieldInfo = new Vector();
//... lines of code populating vectFieldInfo
rs = new RecordSet("TABLE4");
rs.setFieldInfo(vectFieldInfo);
vectFieldInfo = new Vector();
//... lines of code populating vectFieldInfo
rs = new RecordSet("TABLE4", vectFieldInfo);
Note:
rs is a record set with no field data assigned to it
vectFileInfo, a vector, is populated as in the previous step
functionally, the two bottom lines in the first segment and the last of the lower one are exactly the same.