Is it possible to get document id of uploaded file(a!fileUploadField()) within same interface without submitting a form?

I have uploaded a file using a!fileUploadField() and i want document id of uploaded file in same interface without submitting a form.

  Discussion posts and replies are publicly visible

  • I've just finished implementing a similar use case, where a user uploads an excel spreadsheet and Appian displays a grid of the rows inside the spreadsheet.

    I used 2 card layouts... one for Step 1: Import, and the second for Step 2: Display Grid. 

    Inside Step 1 card layout was the file upload field. Inside Step 2 card layout was the grid.

    The visibility of step 1 or step 2 was based on whether ri!spreadsheet was null or not. 

    local!showStep1: if (isnull(ri!spreadsheet), true, false),
    local!showStep2: if (isnull(ri!spreadsheet), false, true),

    Another local variable stored the uploaded file id (because the actual file data cannot be accessed until after the form has been submitted).

    label: "",
    labelPosition: "ABOVE",
    target: cons!RP_Documents,
    fileNames: "excel_" & now(),
    value: local!spreadsheet,
    saveInto: local!spreadsheet,
    validations: {}

    Notice I'm saving the uploaded doc into the local variable (above) and then saving the submitted file into the rule input on form submit (below). This lets me work with the data after the form has been submitted. It also lets me toggle the view of step 1 and step 2, plus test the form at either step just by passing in a document or leaving the rule input null. 

    label: "Submit",
    icon: "table",
    saveInto: {
      a!save(ri!spreadsheet, local!spreadsheet),
      a!save(local!showGrid, true),
      a!save(local!showStep2, true)
    submit: true,
    style: "PRIMARY"

    Lastly, the actual import of the excel file to view in a grid, which is just a matter of iterating through arrays for the imported rows and columns, but that's not part of your particular scope so I'll leave that out of this solution.

  • Step 1: showing the initial form. Take note of the rule input and local variables. Both are null at this point because we are waiting for a file to be uploaded.

    Step 2: File has been uploaded and the document stored in the local variable. The form has not been submitted yet.

    Step 3: Form gets submitted, and then we save the document into the rule input (while hiding Step 1's card layout, calling a rule expression to handle the parsing of the excel data, and then showing Step 2's card layout).

  • I have exactly the same use case as you described above, where I need to upload an excel document and display its data in a grid.  

    How are you extracting the data from the uploaded document to display in the grid?  I am aware of the Excel Tools plugin that provides the funcion "readexcelsheet", but I am wondering if there is a way to do this that does not require a plugin, or a better way to do this.

Reply Children