Problem with multiattachments grid

Hello friends,

I'm struggling with multiattachments grid. My main goal is to present more than one attachment(send by email) in grid. At this moment i can present just one. I don't know why. Can someone give me small tip how to deal with this task? This is my code for attachments grid:

load(
local!documents: folder(tointeger(ri!request.folderId), "documentChildren"),
a!sectionLayout(
label: "",
contents: {
a!gridLayout(
label: "Attachments",
labelPosition: "ABOVE",
headerCells: {
a!gridLayoutHeaderCell(label: "Document Name")
},
columnConfigs: {
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
),
a!gridLayoutColumnConfig(
width: "DISTRIBUTE"
)
},
rows: a!forEach(
local!documents,
rule!AA_AttachmentsGridRow(
document: fv!item,
index: fv!index
)
),
selectionvalue: ri!request.advisorDocument_folder_id,


validations: {},
shadeAlternateRows: true
)
},
iscollapsible: true
)
)

 

 

 

+ the expression called "AA_AttachmentsGridRow"

a!gridRowLayout(
id: ri!index,
contents: {
a!linkField(
label: "name " & ri!index,
links: a!documentDownloadLink(
document: ri!document,
label: document(ri!document, "name")
)
)
}
)

this is how it look inside the process model 

 

 

and there is always one attachement no matter what

  Discussion posts and replies are publicly visible

Parents
  • Hi,

    Your code look fine and it worked for me. I would suggest some try and error point if it helps you,

    1. Print your local!document in some text or paragraph field and see if all data is coming or not.
    2. if all data is coming in local!document, check what is its return type - datatype. If its single datatype like text or number, split it using semicolon in your foreach like split(local!document,";") and in expression dont forget to use trim function like (a!documentDownloadLink(
    document: trim(ri!document),
    label: document(trim(ri!document), "name"))
    3. Check if your rule "AA_AttachmentsGridRow" input variable ri!document is Single Type or not.

    Hope this helps you to find your error.

    Regards,
    Simple Shah
Reply
  • Hi,

    Your code look fine and it worked for me. I would suggest some try and error point if it helps you,

    1. Print your local!document in some text or paragraph field and see if all data is coming or not.
    2. if all data is coming in local!document, check what is its return type - datatype. If its single datatype like text or number, split it using semicolon in your foreach like split(local!document,";") and in expression dont forget to use trim function like (a!documentDownloadLink(
    document: trim(ri!document),
    label: document(trim(ri!document), "name"))
    3. Check if your rule "AA_AttachmentsGridRow" input variable ri!document is Single Type or not.

    Hope this helps you to find your error.

    Regards,
    Simple Shah
Children
  • Thanks for your answer :) After i changed mi document input inside rule!AA_AttachmentGridRow into array it gives me this error now:
    "Error Evaluating UI Expression
    Expression evaluation error in rule 'aa_s_allattachmentsreadonly' (called by rule 'aa_f_backofficeemployeetask') at function a!forEach [line 20]: Error in a!forEach() expression during iteration 1: Expression evaluation error in rule 'aa_attachmentsgridrow' at function 'document' [line 8]: The passed parameter(s) are of the wrong type. Received the type List of Document."

  • Fun thing. We are starting new process from external application and start new process via web API and when i put my attachments there, everything is fine like it shows me in the same grid all of them but when i choose buton send to correction - appian send email to client advisor with message what should he correct. Then he add some attachment and it delete this previous attachments and shows just one :/ Thats so bad :(