Discussion

Upload data by using file listener combines with MSOParseExcelFile

To upload data by using an excel spreadsheet can be done by MSOParseExcelFile. The activity takes two mandatory properties, one is the name of the template file and the other one is the location and name of the uploaded excel file. The details steps of how to configure can be found here: https://pdn.pega.com/configuring-application-bulk-upload-data-using-excel-spreadsheet

When the parsing part is solved it will be great to make this automatically, Instead of uploading files one by one manually, it saves efforts to have a file listener monitors a folder and uploads files inside the folder when they are available. Here are the steps to set up the file listener and call MSOParseExcelFile to do the parsing.

  1. Create a Service File from Records→Integration-Services→Service File. Give it proper label, customer package name and customer class name.
  2. Configure the service file created.
    1. In Method tab, choose Processing method as "file at a time" and Data mode as "text only" since we are going to call MSOParseExcelFile to parse the file as a whole.
    2. In the Request tab, specify initial activity if needed. Skip the Parse segments and specify the final activity. One trick here is when the activity calls MSOParseExcelFile, I modified PRInputStream to java.io.FileInputStream in steps 3 java code to read uploaded file from an absolute path
    3. Also, the parameter TemaplateFRB for the MSOParseExcelFile activity, it follows the format: "webwb!TemplateName!xlsx"
  3. Create a file listener to monitor a folder and call the file service to parse the file content.
    1. Configure the listener node, source location and source name mask.
    2. Listener properties section will be the service file created in above steps 1 and 2.
    3. Provide Requestor login if required.

Comments

Keep up to date on this post and subscribe to comments

December 14, 2018 - 6:06am

Hi haimingz! Thanks for your article. I have some question about step 2.b, could you share the mentioned activity changes?

 

January 8, 2019 - 2:08am

Please share the steps of the Activity in the Service-File