Problems with the download widget

Problems with the download widget

  

Good Day,

I have uploaded a pdf into a DB with the columns FileName, FileContent and FileType, FileName and FileType have the data type "Text" while FileContent has the data type "binary data". 

I used a button with the method submit and used the "Create record" action to put the file uploaded using the upload widget.

I then display the a table in the same webpage, where if i click on the table's row, it should download the corresponding file content, as shown below.

This is what it looks like in my downloads wdiget:

However when I click on the table's row which launches the download widget, I get an exception, "An exception occurred in the client script. Error: The connection to the server was reset".

Can someone point out where I went wrong?

Thank you.

Regards,

Jerome Lieow

Solution

Hello Herome,

The action that ends with a Download must be called also with method set to "submit".
Check if it is defined as "submit", or if you are using "ajax submit".

If it is already set as "submit", check if you are having any error in the Service Center logs, that can give you a lead on what is happening. You can also put a break point into the action start and check if there is something that is causing a problem.

Cheers. 

EDIT:

Looking better to your Download, I think the error is probably the "source".
If the GetEntity1s aggregate is in the preparation and is the source of the table, the "current" will probably not be pointing to the correct record (beside being bad practice use preparation generated content.

Instead, fetch the record that contains the file, again, using the GetEntity1 entity action, passing as argument the id that will be set in your TableRecords.List.Current.Entity1.Id.

Every time you click in a line of a Table/List Records, its list current is set to that record.

Solution

Eduardo Jauch wrote:

Hello Herome,

The action that ends with a Download must be called also with method set to "submit".
Check if it is defined as "submit", or if you are using "ajax submit".

If it is already set as "submit", check if you are having any error in the Service Center logs, that can give you a lead on what is happening. You can also put a break point into the action start and check if there is something that is causing a problem.

Cheers. 

EDIT:

Looking better to your Download, I think the error is probably the "source".
If the GetEntity1s aggregate is in the preparation and is the source of the table, the "current" will probably not be pointing to the correct record (beside being bad practice use preparation generated content.

Instead, fetch the record that contains the file, again, using the GetEntity1 entity action, passing as argument the id that will be set in your TableRecords.List.Current.Entity1.Id.

Every time you click in a line of a Table/List Records, its list current is set to that record.

Hi Eduardo,

I did just like you said, and it is all working now. I didn't know downloading required the submit method as well and thank you for the best practices tip.

Regards,
Jerome Lieow


Hello Jerome,

Good to hear I was able to help.
Please, mark my answer as the correct one, to make easier for others with the same question to find a solution.

Cheers,
Eduardo Jauch