Requirement: Suppose if there are 10 rows in an editable grid of which one column is file upload file. If I upload a document in any of the rows for the first time, the file upload fields of other rows needs to be populated with the same document uploaded. After that whenever a document is updated in any of the rows, the new document should be saved. Kindly suggest a way. TIA
Discussion posts and replies are publicly visible
Hi ARUN RAMANATH please find the below code
Hope this will help you
load( local!employees: {{firstName: "John"},{firstName: "Michael"},{firstName: "Mary"},}, local!doc: rule!APN_generateRepeatedValueForArrayLength( local!employees, todocument( null ) ), a!formLayout( contents: { a!sectionLayout( contents: { a!gridLayout( totalCount: count( local!employees ), headerCells: { a!gridLayoutHeaderCell( label: "First Name" ) }, columnConfigs: { a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 3 ) }, rows: a!forEach( items: local!employees, expression: a!gridRowLayout( contents: { a!fileUploadField( maxSelections: 1, value: local!doc[fv!index], saveInto: if( rule!APN_isEmpty( local!doc ), a!forEach( items: local!doc, expression: a!save( local!doc[fv!index], save!value ) ), local!doc[fv!index] ) ) } ) ) ) } ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Button", saveInto: { a!save( ri!doc, local!doc ) }, style: "NORMAL" ) }, secondaryButtons: {} ) ) )