cancel
Showing results for 
Search instead for 
Did you mean: 

Widget Data Not Included in Downloaded CSV After Calculation (Table Widget)

turtleData123
9 - Travel Pro
9 - Travel Pro

Hey all,

I'm using a script to calculate a total value, and inserting said value, into a table widget. It sums up the quantity column, and presents that sum in the last cell of the column. This displays information correctly, and works as a widget. However, when I go to download the csv of the widget, the file doesn't include the calculated value, it's empty (which is what it is before the value is replaced). If I download as PDF or Image, the calculated value is included. Does anyone have a solution/fix so that the table includes the value when downloaded as csv? I imagine that this is happening due to where/when the data is being replaced. Thanks in advance.

widget.on('processresult', function(widget, query) {
	var results = query.result.rows();
	var total = 0;
	
	$.each(results, function(i, row) {
		if (i < results.length - 1) {
			total += row[5].data;
		} 
	});
	var lastRow = results[results.length - 1];
    lastRow[4].data = total;
});
1 ACCEPTED SOLUTION

DRay
Community Team Member
Community Team Member

Hello @turtleData123,

Thank you for your question. Currently .csv exports are done through a headless browser session, so Widget scripts are not applied like they are with other export types. We are working on improving that process. Can you open a support ticket so we can capture your need here and make sure we address it?

Thank you.

David Raynor (DRay)

View solution in original post

2 REPLIES 2

DRay
Community Team Member
Community Team Member

Hello @turtleData123,

Thank you for your question. Currently .csv exports are done through a headless browser session, so Widget scripts are not applied like they are with other export types. We are working on improving that process. Can you open a support ticket so we can capture your need here and make sure we address it?

Thank you.

David Raynor (DRay)

Thanks for the response David  - I ended up opening a ticket and they said a similar thing, the data wouldn't be downloaded because the widget script doesn't affect the JAQL query ran when the CSV is downloaded, makes sense. Currently exploring a Pivot table and looks like it's working much closer to what we need