Import and parsing files into Outsystems

Import and parsing files into Outsystems


Hi everyone,

I have recently started to work with Outsystems platform without much expirence in programming and I'm facing some struggles due to my inexperiency.

Right now I'm struggeling with a task where I whould like to upload a file of binary data into my DB and afterwards perform some sort of parsing in order to get only the information needed. I already search about it and found some tips here in the forum sugesting integration studio.

Although, I would like to ask for some help from the ones with more experience in this field:

1. How to proparly code a page where the user can upload a .txt file into the DB?

2. Should I use the extension ''BinaryData'' and the action ''BinaryDataToText'', to afterwards perform some sort of parsing in order to select the information needed? If so, how?

If someone could be so kind to help me figuring out how to do it or point me a direction to experiment and search a solution, I would be very thankfull.



Hi Gonçalo,

Some of the things you're asking are relatively basic concepts of Outsystems, so I assume you haven't followed the online courses yet. If that is the case, than I strongly advise you to do so to in order to get a good grasp of the basics.

Now let me try to help you with your questions:

1 - First of all, you have to create an entity with an attribute of the "Binary Data" data type. This is the attribute that will store the contents of your file in the DB.

In order to upload the file, you have to use the "Upload" widget in your webscreen. This widget will allow the user to select the file to upload, and will give you access to the binary content of said file in runtime through its "Content" property. Having access to the content of the file, you can now store it in your entity in the DB.

2 - Yes, you can use the "BinaryDataToText" action of the "BinaryData" extension to get the actual text contents of a text file.

First of all, you need to add a dependency to it. Then you just have to call that action passing to its "BinaryData" input parameter the contents of your file. If you intend to do this at the same time as the user uploads the file, you can once again use the "Content" property of the "Upload" widget. After calling the action, you will have access to the text content of the file through its "Text" output parameter. You can then parse the contents of the file as needed.

I hope this helps.