Question
Capgemini
MX
Last activity: 7 Dec 2022 3:00 EST
Read a text file separated by a tabulator
I have to analyze a text file (txt) with a table structure, each "column" and its records are separated with a tabulation space, to which data type, length and mandatory validations must be applied. How can I achieve this?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
JPMC
IN
@EdgarIvanV Could you provide some example file which you need to read and also brief as to how/where the file would be uploaded.
Capgemini
MX
Hi, thanks for answering.
The file must be loaded from the FilePath control, and the data must be stored in a data page on the clipboard. If possible, be stored in a data type. The file would look something like this, each column, including the header, is separated by a tab:
NexGen Technologies Ltd
IN
@EdgarIvanV i think for your problem can solved by using file listener or file upload using pxparsrexcelfile activity
Capgemini
MX
@Motukatla The file listener I don't think could apply because the file upload is manual (the user clicks a button -the FilePath control- and the user browses for the text file from windows explorer). About your second approach, I am not sure that the pxParseExcelFile activity will work since it is a txt file, not an excel file, since the pxParseExcelFile activity requires as a parameter the template of the excel file via a Binary File.
Updated: 6 Dec 2022 6:18 EST
JPMC
IN
@EdgarIvanV If the ultimate goal is to read a file and save the records into datatype/data table.
- if the client agrees to provide the file as a csv, the ootb approach would be to delegate the data type so that user can upload the file via the delegated rule.
- The other approach would be to create a Service File with Parse Delimited Rule( with delimiter as \t) and invoke the Service File via an activity.
Capgemini
MX
@BhanuPrakash_G Is there an activity method to invoke a "File Service"? I have a "Service File" that maps to a "Parse Delimited Rule", since the file upload is manual through a button -FilePath control- I would like to execute the activity from another button to upload the file after selecting it.
JPMC
IN
@EdgarIvanV As part of the parse segment rule , you need to skip the first row as it contains the column names and also as part of the parse segment row which contains the parse delimited rule an activity needs to be called to append each parsed record into a pagelist else only the last read record will be part of the Service page.
Refer the following screenshots for your reference
Attaching the document which contains the steps to invoke a service file from activity. This activity reads the uploaded file content and calls the service file on it.