Hello there,
I have a Upload field where user uploads 50 rows of 2 columns data from/csv onto form.
I have to read all those and display the data in editable grid before submission.
To achieve this i have used submitUploadedFiles function with empty process model to start on its button click.
Even though data displayed on Interface object correctly, throwing error on front end.
Please help me if i did something wrong.
Added code snippet for upload and button
a!columnsLayout( columns: { a!columnLayout( contents: a!fileUploadField( instructions: "NOTE: CSV file size cannot exceed 50 rows and should only include tickers and weights", target: cons!SRT_FOLDER_UPLOAD_CSV, maxSelections: 1, value: ri!document1, saveInto: ri!document1 ) ), a!columnLayout( contents: a!buttonArrayLayout( buttons: a!buttonWidget( label: "Read File", saveInto: { /*a!submitUploadedFiles(documents: ri!document1),*/ /*a!save(local!validTickers,*/ /*reject(fn!isnull(_),index(a!flatten(index(rule!SRT_INT_bmuMorningstarUniverse(*/ /*tickers:index(local!fileTickers,"ticker",{})*/ /*),*/ /*"result","body","Universe","Security",{})),"Ticker",{}))),*/ a!startProcess( processModel: cons!SRT_PM_UPLOAD_FILE, processParameters: {}, onSuccess: a!submitUploadedFiles( onSuccess: { a!save(local!submissionSuccessful, true), a!save( local!parsedFileData, index( readexcelsheetpaging( ri!document1, 0, a!pagingInfo(1, cons!SRT_INT_FILE_IMPORT_ROW_MAX), 2, null, true ), "data", "values", {} ) ), a!save( local!fileTickers, if( rule!APN_isBlank(local!parsedFileData), {}, a!forEach( items: local!parsedFileData, expression: a!map( ticker: if(fv!isFirst, null, fv!item[1]), allocation: if(fv!isFirst, null, fv!item[2]) ), ) ) ), a!save( ri!portfolioData1, append( ri!portfolioData1, a!forEach( items: remove( local!fileTickers, wherecontains( null, index(local!fileTickers, "ticker", {}) ) ), expression: { 'recordType!{5bf7f7cb-2b7c-430f-93b1-102a13b4f3af}SRT Portfolio'( 'recordType!{5bf7f7cb-2b7c-430f-93b1-102a13b4f3af}SRT Portfolio.fields.{cb090f37-4d4b-43f3-9393-8ceb1cba74a5}tickerOrCusip': fv!item.ticker, 'recordType!{5bf7f7cb-2b7c-430f-93b1-102a13b4f3af}SRT Portfolio.fields.{42f5fce0-6c85-488c-a1e6-ce2d5d14db86}productName': null, 'recordType!{5bf7f7cb-2b7c-430f-93b1-102a13b4f3af}SRT Portfolio.fields.{154478bd-35f2-4ef1-b0f2-81449e3fb855}portfolioVersionRefId': 10, 'recordType!{5bf7f7cb-2b7c-430f-93b1-102a13b4f3af}SRT Portfolio.fields.{277086ff-1613-4c0b-84e9-9932ba4f19bc}investmentType': null, 'recordType!{5bf7f7cb-2b7c-430f-93b1-102a13b4f3af}SRT Portfolio.fields.{df7e6b6d-508d-4a78-8d12-41372a07944f}isActive': true, 'recordType!{5bf7f7cb-2b7c-430f-93b1-102a13b4f3af}SRT Portfolio.fields.{1fc0f544-5ee9-4cdf-990a-e365e1a9d247}allocation': fv!item.allocation ) } ) ) ), }, onError: a!save(local!submissionSuccessful, false) ), onError: a!save(local!submissionSuccessful, false) ) }, ), align: "START", marginAbove: "MORE" ) ) } ),
Discussion posts and replies are publicly visible
Malleswari T said:i have used submitUploadedFiles function with empty process model to start on its button click
Why would you do this? If you're not doing anything with the process model, don't use a!startProcess(). It's not needed for a!submitUploadedFiles() either way.
Initial thought was to see if this function works in first place and move things into process eventually.
Is there any work around to display the uploaded csv document on Interface into editable grid without submitting the form?
Right now user upload document and click submit, looping back to the same interface
.
Want to know if there is better approach as submituploadedfiles() do not support.
Another thought is Save it in temporary folder(which also requires a process) and move to permanent after actual form submit. Either of these need to be submitted once on upload submit and twice on final submit.
It's supported in this context as of Appian 23.2 - what version are you on?
Malleswari T said: as submituploadedfiles() do not support.
On 23.2 i tried an example from documentation which is throwing the error from my initial screenshot/post.
It does not work with or without a process.
Getting Unsupported in this environment on SITE
As per documentation, i think since you are using inside a task, a!submitUploadfiles() wont work. As it is not supported in task and start form
Yup thats my finding as well
Capt_Barbosa said:As it is not supported in task and start form
edit: Apologies, I may have been mistaken about this. I will need to investigate further.
I created an interface and added to site directly which is not a start form or task form then it worked, however if it is inside a start form or task form then failing.
If this is supported in anyway definitely saves lot of our development time.
Sorry, you guys may have been right - i'll need to look further into that. Provided the caveat in the documentation is correct, then you'll likely need to stick with your approach wherein you have the user submit from the form and loop back immediately to the form again, after clicking the "Read File" button.