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

Parents
  • 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).

    a!fileUploadField(
    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. 

    a!buttonWidget(
    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.

  • 0
    Certified Associate Developer
    in reply to Rick Palmer

    Hello Rick,

    I have similar requirement except I want the user to have a look at the data in excel file before writing it to DB,
    So basically I want user to upload the excel file, Once that is done a read only grid will be shown having data in the excel file in that same interface below, then the user can decide to submit it or not.

    I wanted to know is it possible to do that in single interface.

    Thank You. 

Reply
  • 0
    Certified Associate Developer
    in reply to Rick Palmer

    Hello Rick,

    I have similar requirement except I want the user to have a look at the data in excel file before writing it to DB,
    So basically I want user to upload the excel file, Once that is done a read only grid will be shown having data in the excel file in that same interface below, then the user can decide to submit it or not.

    I wanted to know is it possible to do that in single interface.

    Thank You. 

Children
  • You can do it in a single interface, but you'll need to make the user click a "submit" button between uploading the Excel file and having Appian read its contents.  My normal suggestion here would be to add a button to the form saying something like "Load excel contents" that becomes enabled after the file is uploaded, which will then submit the task and cause the process model to loop straight back to the same task again.  As far as the user is concerned, they'll still be on the same task as when they started, plus or minus one button click to "load" the Excel contents.