Unable to download text file with readable content in Reactive web app

Download widget in reactive web only accepts binary data as File content. My requirement is to download the content in text format. However, I am able to download the text file when I specify .txt extension in filename but the file which will be download is not in readable format..

Any suggestions?

Hi Siddhant,

You have to use texttobinarydata server action from binarydata extension to convert your text to binary data and then assign that binary data to download widget:

Give it name with ext as txt. This will download the file which will be visible properly too.

Hi Siddhant,

If you have Text in your OutSystems App, and you use TextToBinaryData like Nikhil showed, the file will download as-is from your browser. If it is not readable as text, that can mean two things:

  1. Your input is somehow wrong; you can check this by debugging the app and check whether inside OutSystems the content is ok;
  2. You use a wrong Encoding: make sure to chose "utf-8" or "ascii" (depending on your input).

Also, on your Download, specify the right Mime-Type: for text, this should be "text/plain" (instead of the default "application/octet-stream").

Hi Kilian/ Nikhil,


My content is Ok, when I download the file in .csv/.xlsx it display all records but my requirement is to download it in .txt format.

However, I have tried the conversion  TextToBinaryData' like Nikhil showed but in my case it is not working i.e. when I use this conversion and I download the file with .txt , still it display the not readable content.

I have my data in binary but my requirement is to download it in text file:

1. when I pass binary data directly to download widget and download it as text file, it displays non readable text.

2. when I convert that binary to text in server action and pass it to client action and then again if I convert that text to binary and pass that binary data to download widget in screen action(reactive web) and download the file, it results again as non readable text.

Hi Siddhant,

What file do you want to download as Text? Do you have a XLSX file in the database, and you want to download the content as Text? What are you trying to do? I get the feeling you have a non-text file in OutSystems, and want to automagically have it converted to text?

Hi Killian,

I am also feeling the same , seems like he has a excel\csv file data which he automatically want to converted in text just by adding the extension .txt and is getting corrupted.

Siddhant - Could you please put some more light on what was the origin of the binary data you want to download in text file ?


Regards,

-PJ-

Good catch Killian & Promod.

I agree that if siddhant is using binary data of an csv or excel file and trying to download as .txt then it is not going to work.

Sharing the source of the binary data may help.


Hi All,

I Understand that the if the source of binary data is excel file, it won't convert it into text by mentioning .txt. 

I just made the try using the conversion mentioned above but what I need is to download the data from table into text format.  

Data Source -: Database table

Any solution to convert table record list data into text format? Attached is the sample 

Hi, 

You can use one of the components from Forge to convert the excel to CSV. 

Cheers. 

P. S. Probably you will need to:

1. Convert excel to list. 

2. Convert list to csv

3. Convert CSV to binary to download. 

Don't know if there is anything that convert directly from excel to CSV. You may take a look on excel components at forge. 

Cheers 

Solution

Siddhant Chauhan wrote:

Hi All,

I Understand that the if the source of binary data is excel file, it won't convert it into text by mentioning .txt. 

I just made the try using the conversion mentioned above but what I need is to download the data from table into text format.  

Data Source -: Database table

Any solution to convert table record list data into text format? Attached is the sample 

Hi Siddhant,

Check attached oml for a sample of downloading your entity data in text format you want.


Solution