/* I intend on having a condition on when the grids display. upon entering this form, the user will see the read only grid to make selections. Then - I plan on adding a button that will switch the view to the editable grid. Then when updates are complete, a button will display to submit the changes - sent to a reviewer for approval....)*/ a!localVariables( /* This variable is used to persist the checkbox on selected items by holding the identifiers of the selected rows. */ local!selection, /* This variable is used to pass the full rows of data on the selected items out of this interface, such as to a process model. In this case, it passes values to ri!newArngmt_cdt*/ local!selectedRows, /* This variable is used to pass the updates made to ri!newArngmt_cdt to ri!updatedArngmt_cdt*/ local!updatedArngmt: ri!newArngmt_cdt, { a!columnsLayout( columns:{ a!columnLayout( contents:{ a!gridField( label: "Update Accounts Associated with this Customer Account", instructions: "Check the box next to accounts that should be updated to new account. Once selected, you will be able to edit.", data: rule!esc_getArngmtRows(ri!selectedAccount_cdt.fiId, ri!selectedAccount_cdt.accountNum).data, columns: { a!gridColumn( label: "RY", sortField: "ryId", value: fv!row.ryID ), a!gridColumn( label: "Routing Number", sortField: "fiId", value: fv!row.fiId ), a!gridColumn( label: "Account Number", sortField: "accountNum", value: fv!row.accountNum ), a!gridColumn( label: "Effective Date", sortField: "effectiveDate", value: fv!row.effectiveDate, align: "END" ) }, pageSize: 6, selectable: true, selectionValue: local!selection, selectionSaveInto: { local!selection, /* This save adds the full rows of data for items selected in the most recent user interaction to local!selectedRows. */ a!save(local!selectedRows, append(local!selectedRows, fv!selectedRows)), /* This save removes the full rows of data for items deselected in the most recent user interaction to local!selectedRows. */ a!save(local!selectedRows, difference(local!selectedRows, fv!deselectedRows)), a!save(ri!newArngmt_cdt, local!selectedRows) } ), a!sectionLayout( label: "Customer Accounts to be Updated", contents: { a!gridLayout( label: "", labelPosition: "ABOVE", instructions: "Make the necessary changes to selected accounts associated to their respective reinsurance years", totalcount: count(local!updatedArngmt), emptygridmessage: "No accounts selected to update.", headerCells: { a!gridLayoutHeaderCell(label: "RY" ), a!gridLayoutHeaderCell(label: "Routing Number" ), a!gridLayoutHeaderCell(label: "Account Number" ), a!gridLayoutHeaderCell(label: "Effective Date", align: "RIGHT" ) }, /* Only needed when some columns need to be narrow */ columnConfigs: { a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:1 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:1 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:2 ) }, rows: a!forEach( items: local!updatedArngmt, expression: a!gridRowLayout( id: fv!index, contents: { a!textField( label: "RY "& fv!index, value: fv!item.ryId, readOnly: true() ), a!textField( label: "FiID "& fv!index, value: if(fv!item.accountNum = ri!newAccount_cdt.accountNum, ri!newAccount_cdt.fiId, ri!selectedAccount_cdt.fiId ), saveInto: fv!item.fiId, readOnly: true ), a!dropdownField( label: "Account Number "&fv!index, choiceLabels: {ri!selectedAccount_cdt.accountNum, ri!newAccount_cdt.accountnum}, choiceValues: {ri!selectedAccount_cdt.accountNum, ri!newAccount_cdt.accountnum}, value: fv!item.accountNum, saveInto: fv!item.accountNum, required: true() ), a!dateField( label: "Effective Date "& fv!index, value: if(fv!item.accountNum = ri!newAccount_cdt.accountNum, today(), ri!newArngmt_cdt.effectiveDate), saveInto: fv!item.effectiveDate, readOnly: true ) } ) ), selectionvalue: ri!newArngmt_cdt, selectionSaveInto: local!updatedArngmt, validations: {}, shadeAlternateRows: true ) } ) } ) } ) } )