We have extended the JavaScript Record functionality so that most database operations can be done without writing JavaScript code.
To change or add a JavaScript Record in a report, in the Property Grid, in the Records row, click the assist edit button (…).
In the Collection Editor, you can now add or change records:
-
To add a new record, click Add and select a table.
The default name for the record is a valid JavaScript name based on the table name – but you can change it if you want to.
-
You can now add flow fields, which are calculated after a record has been read, and you can set a Where filter on the record.
Reading JavaScript Records from the database
Records referring to the Company Information table or the ForNAV Setup table are automatically read from the database before the OnPreReport trigger is run, because they only contain one record (Singletons). Records from other tables must be read using the Javascript <Record>.First() function or using a Data Item Link Reference.
Adding a Data Item Link Reference means that the record is automatically read from the database before the OnAfterGetRecord trigger for the data item using the filters from the data item link and the Where clause. If there is more than one record, the first record is returned and if no record is found, the record is reset.