a!formLayout( label: "Select Employee to View \ Edit Related Information", contents: a!localVariables( /* This variable stores the grid's selection. */ local!selection, /* This variable stores the row information for the grid's selection. */ local!selectedRows, { a!gridField( label: "Single Selection", labelPosition: "ABOVE", data: a!queryEntity( entity: cons!ESC_Employee_DS, query: a!query( selection: a!querySelection( columns: { a!queryColumn(field: "employeeId"), a!queryColumn(field: "empCode"), a!queryColumn(field: "employeeNum"), a!queryColumn(field: "addId") } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "empClosedFlag", operator: "=", value: 0 ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: fv!pagingInfo ), fetchTotalCount: true ), columns: { a!gridColumn( label: " ", sortField: "employeeId", value: fv!row.employeeId, showWhen: false, width: "ICON" ), a!gridColumn( label: "emp Code", sortField: "empCode", value: fv!row.empCode ), a!gridColumn( label: "employee Number", sortField: "employeeNum", value: fv!row.employeeNum ), a!gridColumn( label: "Routing Number", sortField: "addId", value: fv!row.addId ) }, pageSize: 25, initialsorts: { a!sortInfo( field: "empCode", ascending: true ) }, selectable: true, selectionstyle: "ROW_HIGHLIGHT", selectionvalue: local!selection, /* Here we save fv!selectedRows to local!selectedRows. To ensure that only a single row is selected when the user clicks too quickly, we use the index() function to return only the last selected value. */ selectionSaveInto: { /* Using the index function to return the last-selected item ensures that only one item will be selected at a time, regardless of how fast the user clicks. */ a!save(local!selectedRows, index(fv!selectedRows, length(fv!selectedRows), null)), /* We use the same method as above to limit the selection variable. */ a!save(local!selection, index(save!value, length(save!value), null)), a!save(ri!selectedemployee_cdt,local!selectedRows) } /*),*/ /* Grids with selection should always have a secondary display of that selection when there is paging so users are always able to see their selections even when that selection is not on the current, visible page. Because the paging size is so small, we display the selected information below the grid. If it was any larger you would want to display it alongside the grid so users don't miss it. */ /*a!textField(*/ /*label: "emp ID" & local!selectedRows.employeeId,*/ /*value: local!selectedRows.employeeId,*/ /*saveInto: ri!selectedemployee_cdt.employeeId,*/ /*showWhen: false,*/ /*readOnly: true*/ /*),*/ /* This is a simple test field to show the value of the current selection. */ /*a!textField(*/ /*label: "local!selectedRows",*/ /*value: local!selectedRows,*/ /*readOnly: true*/ ) } ), buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", value: "Submit", /*skipValidation: true(),*/ saveInto: ri!whereTo_txt, submit: true, style: "PRIMARY" ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: "Cancel", /*skipValidation: true(),*/ saveInto: ri!whereTo_txt, style: "NORMAL" ) } ) )