Rows.toTable()
note
This article is about the toTable() function of the Rows object.
Rows.toTable()
Converts the records in the Rows object into a plain array of plain objects, keyed by column name. This is useful when you need a plain-data snapshot of the records, for example to pass to code outside the UDB layer.
Returns an array of plain objects.
Syntax
$.udb( *ds* ).rows( [rowRef1], [rowRef2] ).toTable()
$.udb( *ds* ).rowSet( *rowSet* ).rows( [rowRef1], [rowRef2] ).toTable()
The required ds parameter is a data source selector.
The optional rowSet parameter is a rowset identifier. If the .rowSet() clause is omitted, then .rowSet('current') is assumed.
The optional rowRef1, rowRef2 are row selectors. If omitted, all records in scope are addressed.
Example
$.udb('EMP').rows().toTable();
Example result:
[
{ EMPNO: '1', NAME: 'John' },
{ EMPNO: '2', NAME: 'Jane' }
]