Binary File Upload


We are trying to upload data from an uploaded file in the database. A field from the database has a data type of 'Binary Data'.

Below is our logic:

The Entity2 table stores the Binary Data and the BinaryDataToText2 converts this to a more readable format. The file is a .CSV file with utf-8 w/o BOM encoding.

We have tried the logic using the Upload Widget and works like a charm but once we  loop through the table, the system is not reading the Binary Data uploaded in the database.

We are trying to loop this through the database because this will be incorporated with the multiple file upload.

We hope for a positive feedback on this.

Thank you very much.

Nothing to do with your question, but you should never test for Count = 0, but use List.Empty instead. Using the Count will run a count query, which is costly.

Also, you named a table "Entity2", really??? I hope for your sanity this is just a test project...

As for your question, I'm really not sure what you are trying to do with the Upload Widget vs. the table. Since you didn't post that logic, it's difficult to understand what's going on.
Hi Killian,

This is just a test espace for the uploading of the csv files. This is a quick development of the logic which will be then incorporated to a bigger system and will be properly labeled. 

Thank you for your comment. 
Hi Geraldine,

I wasn't insinuating you were insane for creating it, I was worried for your sanity in having to maintain it :).

Could you explain further what you are doing with the Upload Widget, and why it doesn't work? I may be able to help you once I understand what you mean.
The upload widget actually works as is. Our problem
is we have to loop into a series of files. 

The Entity2 table has 2 fields only, the filename and the binarydata of the file. 

I would want to use the binarytotext function of outsystems to extract the text written in the binary file. When using the upload widget (single file) it works properly and i'm able to read data of the binary file but when the binary data comes from the database, i cant seem to read the binary data. I'm using utf-8 encoding for this.
Ok, so if I'm understanding you correctly there are two scenarios:
1) Upload via the upload widget, process the binary data -> result ok
2) Read from the database, process binary data -> result not ok

Am I correct in understanding you? If so, what is the source of the binary data from the database? If you debug, what is the result of BinaryDataToText, is it what you expect?