How to retrieve pdf files stored in folder?

Hi Everyone,

Can anyone please tell me how can I retrieve the pdf files as a link in the interface, based on the name coming from database table? The document is stored in the folder in appian.

Thank You

  Discussion posts and replies are publicly visible

Parents
  • First I'd like to second Mike's suggestion of storing the document ID in the database instead of or along with the file name.  File names are not unique and mechanisms to search your entire document store to retrieve them by name is not scalable and can have extremely poor performance - and you can easily run into multiple documents with the same name which can be impossible to differentiate. 

    There are not any functions OOTB that I know of to do this either, however the Content Tools plugin does contain a function fn!finddocumentsbyname().  This function does not utilize the document extension (name only) so you will have to do additional parsing from the return if there can be docs with different extensions.  We had one older system that stored document names in the DB, a report would show a document link with each process instance, and loading the report was super painful (minutes).  We eventually scripted out a conversion to doc IDs for existing processes and upgraded the process model to avoid this.

    At any rate, once you have a document object you can utilize documentdownloadlink() within a variety of components to allow downloads.  A forum favorite is a!richTextDisplayField due to it's flexibility:

    a!localVariables(
      local!document: todocument(538491),
      
      a!richTextDisplayField(
        labelPosition: "COLLAPSED",
        value: {
          a!richTextItem(
            text: document(local!document,"name"),
            link: a!documentDownloadLink(
              document: local!document
            )
          )
        }
      )
    )

    Additionally our most common method is to store a folder ID in the database related to each process instance, when the documents are typically grouped - then we retrieve the list of docs via the fn!folder(docId,"documentChildren") OOTB function.  In times past we have also used fn!getdocumentsfromfolder() (also part of the Content Tools plugin).

    folder(516521,"documentChildren")

  • I have the id of the document in the interface as a link but the download link to retrive the document stored in the folder will be different for different documents. How can I retrieve those documents.

Reply Children