=load ( local!documentData:{ {ID:ri!ID, uploadedBy:ri!uploadedBy,title:ri!title,uploadedDate: ri!uploadedDate,DocumentID: ri!DocumentID, DocType:ri!DocType}}, local!gridSelection: a!gridSelection ( pagingInfo:a!pagingInfo ( startIndex:1, batchSize:length(ri!ID), sort:a!sortInfo ( field:"Document ID", ascending:true ) ) ), with ( local!datasubset:todatasubset(local!documentData, local!gridSelection.pagingInfo), a!formLayout ( label: "Upload Documents to IFS", instructions: "Please upload the documents you want to upload here.", firstColumnContents:{ a!gridField( label:"Documents", instructions:"You may upload more documents by clicking on the upload button", totalCount: length(ri!ID), selection: true, identifiers:ri!ID, columns: {a!gridTextColumn(label: "Document ID", field:"DocumentID", data: { index(local!datasubset.data, "DocumentID", {})}, alignment:"LEFT", links:{a!applyComponents(function:a!documentDownloadLink(document:_, label:_), array:merge(ri!DocumentID, ri!title) )}), a!gridTextColumn(label:"Uploaded By", field:"uploadedBy", data:{index(local!datasubset.data, "uploadedBy", {})}, alignment:"LEFT" ), a!gridTextColumn(label:"Uploaded Date", field:"uploadedDate", data:{index(local!datasubset.data, "uploadedDate", {})}, alignment:"LEFT"), a!gridTextColumn(label:"Title", field:"title", data:{index(local!datasubset.data, "title", {})}, alignment:"LEFT"), a!gridTextColumn(label:"ID", field:"ID", data:{index(local!datasubset.data, "ID", {})}, alignment:"LEFT"), a!gridTextColumn(label:"Document Type", field:"DocType", data:{index(local!datasubset.data, "DocType",{})}, alignment:"LEFT") }, value: local!gridSelection, saveInto:{ local!gridSelection, if( count(local!gridSelection.selected) > 1,{}, ri!selectedDoc << index(_, "selected", null))}, validations: if(count(local!gridSelection.selected) > 1, "You may only select one document", null) ) }, buttons:a!buttonLayout(primaryButtons: a!buttonWidgetSubmit(label:"Submit",style:"PRIMARY", value:"Submit", saveInto:ri!btn), secondaryButtons:{ a!buttonWidgetSubmit(label:"Upload", value:"Upload", saveInto:ri!btn), a!buttonWidgetSubmit(label:"Delete", value:"Delete", saveInto:ri!btn)}) )))