Load Rich Display Grid using SQL
In the examples below, the assumption is made that the display grid fields have matching field names and definitions to the database table fields.
Load all records at once
pjs.defineDisplay("display", "mydisplay.json");
var records = pjs.query("SELECT * FROM ORDERS");
display.grid1.replaceRecords(records);
Load one record at a time using primitive objects
pjs.defineDisplay("display", "mydisplay.json");
display.grid1.clear();
var c1 = pjs.allocStmt();
c1.executeDirect("SELECT * FROM ORDERS");
var record = c1.fetch();
while (c1.hasMoreRows()) {
// custom processing before record is added can go here
display.grid1.push(record);
record = c1.fetch();
}
Load one record at a time using a data structure with global fields
pjs.defineDisplay("display", "mydisplay.json");
pjs.define("ordersDS", { type: 'data structure', extName: "ORDERS"});
display.grid1.clear();
var c1 = pjs.allocStmt();
c1.executeDirect("SELECT * FROM ORDERS");
pjs.fetch(c1, ordersDS);
while (c1.hasMoreRows()) {
// custom processing before record is added can go here
display.grid1.write();
pjs.fetch(c1, ordersDS);
}
Some documentation pages have recently moved to a new section: Profound AppDev. If you are having trouble finding specific pages, try the documentation search capability or reach out to our Support team!