I want to parse a user-uploaded CSV file from a interface to database and show the imported records from database in the same interface

I have a interface where user can upload a CSV file. In the process model I have some duplicate checking functionality and then "import csv to database" smart service to insert the data to the database table. Now, I want to show a short message to the user that, how many of the records are successfully stored in the database. I want to show it in a modal or somewhere below in that interface (the CSV upload interface). How can I achieve that?

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Hi sudipta,

    You can query the data table using the query entity or query rule and can show the total count of the records to user in the same interface
  • Hi Sudiptab, You can loop back the same Interface once the process model is successfully executed. You can use a rich text field to display that Message.
  •  : Take the OutPut of The Write Node data and Display the count in Confirmation Screen[Next User Input Task]  (OR) In same Interface Loop back and Display it .

    Thanks!!

  • Hi Sudipta,
    I would assume the volume of data in CSV file would be on a higher side, so it is not advisable to store the values in process variable after parsing.

    1)Use com.appiancorp.ps.exceltools-2.0.2.jar plugin--> Import CSV to Database(smart service) to achieve this use case.
    2)In your process model call execute stored procedure(smart service) to retrieve the total count of data(Before Parsing). You may use select count(1) from TABLE query in a stored procedure to get total count before and after writing the new file and display in the UI.
    3) If you are doing any dublicate checks use another stored procedure(Write cursor logic inside).
    4) Always have a staging table to insert the data of CSV file parsed through the above mentioned plugin and once parsed call stored procedure(Cursor logic to check duplicate).

    The method is very efficient and takes only few seconds.
    ***Refrain from storing data in PV*** use the plugin (smart service- Import CSV to Database) to make it very efficient.

    Hope that helps!

    Abhishek

  • Hi Sudipta,

    I agree with @chandu approach. Take the csv file and then when hit submit it will hit next node in the process model where you can do necessary things and then loop back the same UI again. it only works when you have limited number of rows, If you have more data then the activity chain may break in the case you may have to show a message on UI saying that once the data is loaded you will get a task assigned.

    Thanks.