Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

Upload and analyze a file in a User Input Task

Certified Associate Developer

Hi everyone,

Im using an User Input Task with a!fileUploadField. What I need is to verify that the Excel uploaded does not contain mor than 500 rows so the user cannot submit the form. But as the file is temporary I cannot access to its information, and I alreay saw that it is not possible using a!submitUploadedFiles function. Any ideas for solving this?

Thank you!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Whether you are using folder stored documents or record managed ones you can read the data in the saveInto of the fileUpload component and using that validate the data. Here is a code you can refer which uses readexcelsheetpaging() which comes as part of Excel Tools plugin. 

    a!localVariables(
      local!dataLength,
      {
      a!fileUploadField(
        label: "Docs",
        target: cons!HSS_DOCUMENTS_TARGET,
        maxSelections: 1,
        saveInto: {ri!doc,
        a!save(
          local!dataLength,
          readexcelsheetpaging(
           ri!doc,
            0,
            a!pagingInfo(1, 50)
          ).totalCount
        )},
        instructions: ri!doc,
        validations: if(local!dataLength>20,"Maximum 20 rows are allowed",""),
        value: ri!doc
      )})

    P.S My code is written & tested in Appian v25.2 & v25.3. Check if it works for you depending on the version you are working on! Let me know how it goes.  

  • 0
    Certified Associate Developer
    in reply to Harsha Sharma

    I have a similar requirement as Shubham, except mine is a CSV file. The approach by Harsha works for an excel file but not for csv file. Any idea how to implement this for an CSV file.

Reply Children