Is there any way to bypass the download widget for downloading large file
Application Type

I need to give option to download report from DB in excel to User.

For that I created a server action which gets data from DB, feed into excel  and give back to client action as binary data. Client action is giving it to user via "Download Widget".

For small chunk of data this is working fine.

But for 500K, 1000K , 1200K rows, it is not.

Because for getting data from DB and feeding it in Excel is taking 30-60 seconds for 1000K rows but giving binary back to client action is taking more then 1000 seconds which is huge ( sometime it gives connection timeout ).

In this way it holds user on page until 100% download gets complete or fail.

Is there any way I can initiate the download right from the server action, just after creating the excel ?

in this way I will hold user on screen only until excel is created, right after excel part is done i want to initiate the download and release the hold from web application. Now download will be run on client side and user will be free to use the application 

So is there any way to bypass the download widget or use the download by URL which we can see generally  implemented everywhere in web ?

Rank: #1217


First that is a lot of data that you are trying to download.

But what you can do is create a Timer that will process the excel file and generate it for you, then on the UI all you have to do is download it from the database.

What you need?
1)Control table that holds the excel file and some ID so you can track the right one
2) Timer that will generate the excel file and save it into that table
3) on the UI maybe a JS that will every 10/20 secs check if the excel is generated or not
   3.1) If its generated you can trigger the download automatically

4) After the download delete the excel from the database ( so you don't fill it with that large amount of data in case you don't need it anymore)

Rank: #2

Hi Luís,

The OP is concerned about the time that's needed to download a large file, not the time to generate it server-side. They explicitly say so: "getting data from DB and feeding it in Excel is taking 30-60 seconds for 1000K rows but giving binary back to client action is taking more then 1000 seconds". So although your answer is correct for a different question, it's not the solution here.

Rank: #4788

Hi Luis,

Yes, as Kilian says, I am hoping for a solution which can save time to give binary from server to client. That is the challenge,  if we can bypass that route and directly give file to user from server action.

With your suggested approach, again it will take time to download file from DB and application will stuck until 100% download or failure.

I am attaching a download flow of another application ( not build on outsystems ) there when user click on download button,  immediately it starts downloading in browser and user can see the progress from 0-100% ( Traditional download from URL in html5 )

like this:  <a href="/images/myw3schoolsimage.jpg" download> 

So, is there any possibility to implement sort of similar solution in outsystems ?

In outsystems , "Download widget" does not work like this ( Or may be I am not fully aware about it ) , it takes 100% downloaded binary file and give it to user.