We are currently performing maintenance on Appian Community. As a result, discussions posts and replies are temporarily unavailable. We appreciate your patience.

Multiple File Upload

How can we make the File upload component as dynamic ? I have a rule input which has the type has a record type , so i cant select the multiple array option it it. The document id should be stored in the DB and the files should be saved in a Target folder.

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    You need to implement a separate record to hold the documents and define a one-many relationship from the original record to the new document record.

  • I have been told -

    You need to insert one row for each document you want to upload 

    e.g  if you are uploading the 3 doc in single file upload then you will insert 3 differnt row in database 

    1 row per each document .

    How can I achieve this?

  • 0
    Certified Lead Developer
    in reply to SM

    I assume you are talking about some interface code.

    The following code snippet works for me. You will have to adapt it to your scenario.

    {
      a!fileUploadField(
        label: "File Upload",
        labelPosition: "ABOVE",
        value: index(ri!documents, 'recordType!{08eba301-a3a4-48a7-b036-9f1f6ad15733}TST Document.fields.{e4de7e9c-c508-46bf-8469-7ef29ce17201}document', null),
        saveInto: a!save(
          target: ri!documents,
          value: a!forEach(
            items: save!value,
            expression: 'recordType!{08eba301-a3a4-48a7-b036-9f1f6ad15733}TST Document'(
              'recordType!{08eba301-a3a4-48a7-b036-9f1f6ad15733}TST Document.fields.{e4de7e9c-c508-46bf-8469-7ef29ce17201}document': fv!item
            )
          )
        ),
        validations: {}
      )
    }

  • 0
    Certified Associate Developer

    One option would be to create a rule input of type document with multiple values and save the multiple documents into that rule input. After that save all the document IDs into an array and use the joinarray() function with the separator ";". This will save the list as one long string with semicolons separating the individual IDs. This allows you to save all the IDs into one varChar row in your database. When you want to call that data back into an interface, you can use the split function separate the IDs again into individual document IDs.