Bankat
Bankat

Reputation: 65

Export data into text file in OutSystems

I am working with exporting data in OutSystems and would appreciate some help with it.

Detailed description:

  1. I have data in an entity in my application.

  2. When the user is logged in (for example user is a borrower or co-borrower) , when the user clicks on an export button, then all the data for the logged in user id should be exported into a text file.

  3. How do you get the user id in OutSystems.

So I want store data from an entity to structure, and export that data into a text file (in binary format) for the logged in user id.

Upvotes: 1

Views: 1603

Answers (1)

André Vieira
André Vieira

Reputation: 91

Not sure if I totally get what you want to do but here goes an idea...

First of all you need to fetch the data from the database using the UserId as a filter. I'm assuming you have an attribute on your entity that allows you to do this filtering. If you do just use an Aggregate to fetch that entity and using the Session.UserId as a value for the filter, e.g. Entity.UserID = Session.UserId.

Once you fetched the data you need to iterate over the returned list of elements and append the information you want to a string using the StringBuilder actions you'll find in Text extension. Finally the export this as a binary file use the TextToBinaryData action from the BinaryData extension and use this output in a Download tool. The Download tool should be used in a Screen Action bound to a link or button on your screen.

I hope this helps...

Cheers.

Upvotes: 3

Related Questions