Skip to main content
Known Participant
December 15, 2024
Question

Unable to add rows dynamically using records

  • December 15, 2024
  • 7 replies
  • 8 views

Hi , Can anyone help me with this please!. Thank you for the help in advance.

local!pdf ,

ri!upload: recordType!ABC(),

.

....

.....

shadeAlternateRows: true,
addRowLink:a!dynamicLink(
label: "Add",
saveInto: {
a!save(
local!pdf,
append(local!pdf, ri!upload)
)
}
)

I am trying to add a new row , but maybe i am using ri!upload as value  i am unable to get the desired output , the interface iis showing the same uploaded images  every time i click on add new image link. 

    7 replies

    mathieud0001
    Brainy
    December 16, 2024

    That's normal since you are saving multiple files in the same variable (ri!upload).

    Here is an example that might help understand

    a!localVariables(
      local!pdfs,
      a!gridLayout(
        headerCells: { a!gridLayoutHeaderCell(label: "File") },
        rows: a!forEach(
          items: local!pdfs,
          expression: a!gridRowLayout(
            contents: {
              a!fileUploadField(
                value: local!pdfs[fv!index].fileId,
                saveInto: local!pdfs[fv!index].fileId,
                maxSelections: 1
              )
            }
          )
        ),
        addRowLink: a!dynamicLink(
          label: "Add new row",
          saveInto: {
            a!save(
              local!pdfs,
              append(local!pdfs, a!map(fileId: null))
            )
          }
        )
      )
    )

    jayaprakashr0001
    Participating Frequently
    December 16, 2024

    You are trying to append the ri!  variable to a local variable . Can you specify what is the data passed to ri! is it the record structure .

    Instead you can use the record type in the local variable and append it to the local variable local!pdf. 

    Known Participant
    December 16, 2024

    data passed to ri! is the record . 

    I have tried doing it but its not working , i have called a record in local variable and tried to append with local!pdf.

    jayaprakashr0001
    Participating Frequently
    December 16, 2024

    ok, for local!pdf you need to give like an array set. 

    Try local!pdf: {} it will work.

    In the ri!record for the record give the  empty data like

    recordType!ABC(

    id:null(),

    createdby:null()

    )

    give all the required fields to capture in the Grid