=load( local!selectedEmployeeIds, local!buttonAction, local!employeeData: { {id: "john.smith", first: "John", last: "Smith", email: "john.smith@example.com"}, {id: "michael.johnson", first: "Michael", last: "Johnson", email: "michael.johnson@example.com"}, {id: "elizabeth.ward", first: "Elizabeth", last: "Ward", email: "elizabeth.ward@example.com"} }, /* Set the default paging and sorting config `*/ local!gridSelection: a!gridSelection( pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 25, sort: a!sortInfo( field: "last", ascending: true ) ) ), with( /*` Replace the value of local!datasubset with `a!queryEntity()`, or */ /* `queryrecord()`, or use your own CDT array in todatasubset() */ local!datasubset: todatasubset(local!employeeData, local!gridSelection.pagingInfo), a!formLayout( validations:if(and(length({local!selectedEmployeeIds}) <>1,local!buttonAction="Edit"),"Please select one id", if(and(length({local!selectedEmployeeIds})<=0,local!buttonAction="Delete"),"Please select atleast one id",{}) ), label: "SAIL Example: Grid Selection"&local!buttonAction, firstColumnContents:{ a!gridField( validationGroup: label: "Employees", totalCount: local!datasubset.totalCount, columns: { a!gridTextColumn(label: "First", field: "first", data: index(local!datasubset.data, "first" , {})), a!gridTextColumn(label: "Last", field: "last", data: index(local!datasubset.data, "last" , {})), a!gridTextColumn(label: "Email", field: "email", data: index(local!datasubset.data, "email" , {})) }, identifiers: index(local!datasubset.data, "id" , {}), value: local!gridSelection, saveInto: { local!gridSelection, a!save(local!selectedEmployeeIds, index(save!value, "selected", null)) }, selection: true ), a!textField( label: "GridSelection", value: local!gridSelection, readOnly: true ), a!textField( label: "Grid Selection Selected Ids", instructions: "From local!gridSelection.selected", value: local!gridSelection.selected, readOnly: true ), a!textField( label: "Your Variable Selected Ids", instructions: "From local!selectedEmployeeIds", value: local!selectedEmployeeIds, readOnly: true ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Edit", value: "Edit", submit:if(length({local!selectedEmployeeIds})=1,true(),false()), saveInto: local!buttonAction ), a!buttonWidget( label: "Delete", style :"PRIMARY", submit:if(length({local!selectedEmployeeIds})>0,true(),false()), value: "Delete", saveInto:local!buttonAction ) } ) ) ) )