Skip to main content
New Participant
Mar 29, 2021 4:21 PM UTC
Solved

I want to display attachment details after I upload the attachment. unable to find a good example

I have a requirement where after I upload the attachment, I need the following tabular information needs to be shown as read-only . I could not find a good example in SAIL documentation

Say, if I upload a file name abc.txt then the following info need to be displayed.

Name            File Name        File Type     Uploaded By      Date

abc.txt             abc                      TXT        loggedinuser   3/31/21

test.doc            Test                     DOC      loggedinuser   3/25/21

csteward
cstewardAnswer
Brainy
Mar 29, 2021 8:13 PM UTC

Additionally, here's some sample code to display document details in a grid fashion utilizing the folder ID to retrieve documents (how we typically do it):

a!localVariables(
  local!docs: fn!folder(500170,"documentChildren"),
  
  a!gridLayout(
    headerCells: a!forEach(
      items: {"Name","Type","Size","Uploaded By","Date"}, 
      expression: a!gridLayoutHeaderCell(label: fv!item)
    ),
    columnConfigs:  a!forEach(
      items: fn!repeat(5,"DISTRIBUTE"), 
      expression: a!gridLayoutColumnConfig(width: fv!item)
    ),
    rows: a!forEach(
      items: local!docs,
      expression: a!gridRowLayout(
        id: fv!index,
        contents: {
          a!richTextDisplayField(
            value: document(fv!item,"name")
          ),
          a!richTextDisplayField(
            value: document(fv!item,"extension")
          ),
          a!richTextDisplayField(
            value: document(fv!item,"size")
          ),
          a!richTextDisplayField(
            value: document(fv!item,"lastUserToModify")
          ),
          a!richTextDisplayField(
            value: document(fv!item,"dateCreated")
          )
        }
      )
    )
  )
)

4 replies

stefanhelzle0001
Brainy
Mar 29, 2021 4:45 PM UTC

There is plenty discussions covering this topic here.

In short, document information is only available after submit. For your use case, create a second interface showing your grid and enable chaining in the process model to forward the user directly to this interface.

csteward
cstewardAnswer
Brainy
Mar 29, 2021 8:13 PM UTC

Additionally, here's some sample code to display document details in a grid fashion utilizing the folder ID to retrieve documents (how we typically do it):

a!localVariables(
  local!docs: fn!folder(500170,"documentChildren"),
  
  a!gridLayout(
    headerCells: a!forEach(
      items: {"Name","Type","Size","Uploaded By","Date"}, 
      expression: a!gridLayoutHeaderCell(label: fv!item)
    ),
    columnConfigs:  a!forEach(
      items: fn!repeat(5,"DISTRIBUTE"), 
      expression: a!gridLayoutColumnConfig(width: fv!item)
    ),
    rows: a!forEach(
      items: local!docs,
      expression: a!gridRowLayout(
        id: fv!index,
        contents: {
          a!richTextDisplayField(
            value: document(fv!item,"name")
          ),
          a!richTextDisplayField(
            value: document(fv!item,"extension")
          ),
          a!richTextDisplayField(
            value: document(fv!item,"size")
          ),
          a!richTextDisplayField(
            value: document(fv!item,"lastUserToModify")
          ),
          a!richTextDisplayField(
            value: document(fv!item,"dateCreated")
          )
        }
      )
    )
  )
)

New Participant
Mar 30, 2021 3:06 PM UTC

thank you all

vamsik0002
Known Participant
Mar 31, 2021 11:58 AM UTC

document() can help you