Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Suraj Borade
192
Views
7
Comments
Read text file line by line
Question
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.
Thanks.
Gerry
Use the Split action of the Text extension
Suraj Borade
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?
Gerry
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.
Kilian Hekhuis
MVP
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.
Pedro Coelho
MVP
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,
PC
António Rodrigues
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.
https://msdn.microsoft.com/en-us/library/ms188365.aspx
hope it helps
Suraj Borade
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.
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...