How to display the attachments stored in a folder in interface.

Hi everyone,

I have the requirement to display the attachments stored in a folder, whose unique names are present in database. I would like to provide a link to user in such a way that the name is displayed in the interface and when user clicks over it, the attachment gets downloaded.

Thank You.

  Discussion posts and replies are publicly visible

Parents
  • Here's an example interface that assumes you're starting with a folder / folder ID containing documents, and displays each one as a consecutive link in a single Rich Text Display Field - this can be rearranged in any number of different ways depending on your particular need.

    a!localVariables(
      
      local!documents: getdocumentsfromfolder(
        rootFolder: ri!folder,
        recursiveSearch: false()
      ),
      
      a!boxLayout(
        label: "Documents",
        contents: {
          a!richTextDisplayField(
            value: {
              a!forEach(
                local!documents,
                {
                  a!richTextItem(
                    text: {
                      a!richTextIcon(icon: "file-o"),
                      " ",
                      document(fv!item, "name"),
                      ".",
                      document(fv!item, "extension")
                    },
                    link: a!documentDownloadLink(
                      document: fv!item
                    )
                  ),
                  char(10)
                }
              )
            }
          )
        }
      )
    )

    result:

Reply
  • Here's an example interface that assumes you're starting with a folder / folder ID containing documents, and displays each one as a consecutive link in a single Rich Text Display Field - this can be rearranged in any number of different ways depending on your particular need.

    a!localVariables(
      
      local!documents: getdocumentsfromfolder(
        rootFolder: ri!folder,
        recursiveSearch: false()
      ),
      
      a!boxLayout(
        label: "Documents",
        contents: {
          a!richTextDisplayField(
            value: {
              a!forEach(
                local!documents,
                {
                  a!richTextItem(
                    text: {
                      a!richTextIcon(icon: "file-o"),
                      " ",
                      document(fv!item, "name"),
                      ".",
                      document(fv!item, "extension")
                    },
                    link: a!documentDownloadLink(
                      document: fv!item
                    )
                  ),
                  char(10)
                }
              )
            }
          )
        }
      )
    )

    result:

Children