Question
Only first entry taken
So, I have a form for " Document Details", the user can enter as many documents as they want.

and when they add a document, it should appear in the grid.
I declared " local!indexNum" as index , so the user can enter many documents.
And here is an example code of how i entred data:
a!dropdownField(
label: "Main Type",
labelPosition: "ABOVE",
placeholder: "--- Select a Value ---",
choiceLabels:local!type['recordType!{ba0dd34e-52a6-4f09-ba3a-dd6885feda5b}SKJ Main Type.fields.{e5eb76e0-4885-44d7-b9c3-263533a5f721}descEn'],
choiceValues: local!type['recordType!{ba0dd34e-52a6-4f09-ba3a-dd6885feda5b}SKJ Main Type.fields.{4a008dc7-3ea8-466e-a515-75c5cb965a49}itemCode'],
value:
if(
a!isNotNullOrEmpty(local!filled),
ri!DocDetails[local!filled].mainType,
ri!DocDetails[local!indexNum].mainType
),
saveInto: {ri!DocDetails[local!indexNum].mainType},
searchDisplay: "AUTO",
required: true,
validations: {}
)
The thing is that in the grid, and even in the database it only saves the value of the first entry and duplicated it for others:
But the ri!DocDetails seems to have different values for the 2 different items.


This is what is in the "Add a document" button :
a!buttonWidget(
label: "Add A Document",
icon: "plus-circle",
value: true,
saveInto:{
local!clicked,
a!save( ri!DocDetails,
append(ri!DocDetails,local!documentDetails)),
a!save(local!addDoc,false),
a!save(local!indexNum,local!indexNum + 1),
a!save(local!addnewdocument,local!addnewdocument + 1)
},
style: "LINK"
)
Tell me if you need to see more of the code .
