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
AFAIK....As soon as you uploaded your file temporary document id will be generated. which you cannot use for any future reference. actual document id will be generated after submitting the form only.
Can you describe why you would want to do this? You can get a temporary ID immediately after uploading on a form by using the saveInto on your file upload field. However, the document won't be stored in Appian until the form is submitted, so the ID would be meaningless without submitting the form.
When user upload excel file i need to read that excel file and show the data in grid without submitting a form
Ah okay, that isn't possible. Since the file isn't uploaded until form submit, you can't access any data from the file until they submit. One thing you could do is to create multiple forms that are activity chained together: https://docs.appian.com/suite/help/latest/Process_Model_Recipes.html#using-activity-chaining-to-display-multiple-forms-in-succession
Your first form could include the file upload and a "Next" button. Then, that button would submit the form, you could extract the data from the excel file in process and then display it on the next form that you have chained to it. It's not quite as elegant as displaying the data immediately after upload, but it would probably still work.
Hello Peter Lewis is there any other way on achieving this today? Is it possible to call a process using a!startProcess in the fileUpload saveInto, pass the document, store it and then access it in the Appian interface?
That sounds potentially over complicated - what's your use case?
It won't work by calling a!startProcess on the saveInto because the document won't exist until the original form is complete. I second Mike's question - what's your use case here?
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.
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).
Rick Palmer 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.