Read text file line by line

Read text file line by line

Hello Intelligent people,

I have text file of specific format. I want to read it's contents line by line. Whenever my cursor comes at every line, I want to split that line and store splitted contents in database. 

Please advice how to read text files line by line.


Use the Split action of the Text extension
Hi Gerry,

Thanks a lot for the reply.

I tried Splitting the text file using that action but my concern is that how would I come to know that my cursor has reached to next line.

Do you have any samples?
When you split the text on a delimeter, say line feed (char(10)) or carriage-return, line feed (chr(13)+chr(10)), each line will be seperate record in a record list. Use the For Each to iterate through the list to read each line.
Hi Suraj, Gerry,

In I think Platform 4.2, there was a system component called "FileSystem" that had all kinds of nice stuff, including reading all lines of a file. Unfortunately, it was discontinued for unknown reasons. In the Forge there's at least one component that derives from this, maybe that's of use. There also another component that may also have this feature (reading lines), but I'm not certain.
FileSystem still exists, I just installed Html2PdfConverter yesterday and it has a dependency for FileSystem and installed it.

And yes it's the OS Staff maintained (even though it's not a featured extension), going way back

Best regards,
Hi Suraj Borade,

Don't know if this will work, but can you try to create an entitie,  with one record text leght. Then use advanced query to and load your file using sql to that expecific table, then you can work your records.

You can see in the link bellow, ho to create your specific bulk insert code, to your specific text file.

hope it helps
Hello everybody,

Thanks a lot for replies.

I tried everything but splitting text on delimiter worked.

I used StringSplit action and applied chr(10) on delimeter. Now StringSplit is returning me RecordList and I am able to traverse through the record list.

Thanks a lot.