In some cases it is convenient to to use tables as a summary list and do all your detail edits on the main form. For instance perhaps you want to collect information on beneficiaries, investments or assets. Wouldn't it nice if you could keep a running list and do all your detail edits on the main form versus having the pop up the table dialog for each row? Both approaches work - but sometimes you want a little more control over the user experience.
Here is an example to see.
created with HCL Leap 9
You can get a value from a field in a table by selecting the table row and referring to the field ID. The table row selection can be done by clicking on the row (onClick event) or programmatically.
Manual Table Row Selection
The code below is place on the table onClick event to capture the selected row. The second line sets a field value on the main form (F_FieldB in this example) to the value of a field value in the selected table row.
var selected = item.getSelection(); BO.F_FieldB.setValue(selected.F_FieldA.getValue());
Programatic Table Row Selection
Below is example of how to programmatically select a table row and a specific field value. In this case we are setting the variable "result" to the value of F_SelectOne2 in table row 2. Arrays - which is what tables are - always start with 0, which means BO.F_Table1.get(1) will get the 2nd row. This assumes you know which row to select. If you do not - you can use this technique inside a loop where you search for the table row.
var result = BO.F_Table1.get(1).F_FieldA.getValue() ; // where i= the row number in the table. BO.F_FieldB.setValue(result);
Going the other way - you can grab a field value on the main form and then set a selected table row / field value to it.
var selected = page.FTable1.getSelection(); selected.F_FieldA.setValue(BO.F_FieldB.getValue());
Add Comment