=load ( local!selectedDocumentId, local!documentData:{ {ID:ri!ID, uploadedBy:ri!uploadedBy, title: ri!title, uploadedDate:ri!uploadedDate, DocumentID:ri!DocumentID }}, 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: local!datasubset.totalCount, selection: true, identifiers: index(local!datasubset.data, "ID", {}), columns: {a!gridTextColumn(label: "Document ID", 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", data:{index(local!datasubset.data, "uploadedBy", {})}, alignment:"LEFT" ), a!gridTextColumn(label:"Uploaded Date", data:{index(local!datasubset.data, "uploadedDate", {}}, alignment:"LEFT"), a!gridTextColumn(label:"Title", data:{index(local!datasubset.data, "title", {}}, alignment:"LEFT"), a!gridTextColumn(label:"ID", data:{index(local!datasubset.data, "ID", {}}, alignment:"LEFT") }, value: local!gridSelection, saveInto:{ local!gridSelection, if( count(local!gridSelection.selected) > 1,{}, local!selectedDocumentId << 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)) )))