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
You have to apply similar conditions in the saveInto parameter of each fileUploadField() except the first one. isnull(ri!doc1), isnull(ri!doc2), etc.. If it is null, make the saveInto parameter as ri!doc else keep it as ri!doc1....
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: {} ) ) )
Hi ARUN RAMANATH,
Hope you have arrived to a solution by now. If not can you please attach the code snippet so as to help us understand the problem clearly. This may help us suggest you better approach.