Skip to main content
New Participant
March 29, 2021
Solved

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

  • March 29, 2021
  • 4 replies
  • 0 views

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

Best answer by csteward

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
March 29, 2021

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
March 29, 2021

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
March 30, 2021

thank you all

vamsik0002
Known Participant
March 31, 2021

document() can help you