submitUploadedFiles Function usuage

Certified Lead Developer

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

Parents Reply
  • 0
    Certified Lead Developer
    in reply to Mike Schmitt

    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.

Children