Hi,
This below answer is only applicable to below version 5.0 of EE of Helical Insight.
In order to add ROW total as very first record (top of all rows), you have to made some changes in script which you were following. Below I am providing updated scripts (2 scripts), apply both scripts one after other in JS editor of your adhoc report.
This will disable pagination and shows all records on single page and at top it will show TOTAL :
- Create any tabular report.
- Inject this script in JS Editor to remove pagination. This step we are following because we want total of every row and not for just that page. Removing pagination will show all data at once on a single page:
hi_container.set("preExecution",function(c){
var viz_Options = c.get("viz_Options");
viz_Options["rowCount"] = [-1];
c.set("viz_Options",viz_Options);
});
Inject another script mentioned below to show TOTAL value as ROW at very top.
hi_container.set("postFetch",function(c){
var responseData = c.get("responseData");
var measure1 = 0;
for(var i=0;i<responseData.data.length;i++){
measure1 += responseData.data[i].sum_travel_cost;
var fullSumMeasure1 = measure1;
}
responseData.data.unshift({employee_name: "<b>TOTAL</b>", sum_travel_cost: fullSumMeasure1}); c.set("responseData",responseData);
});
NOTE : Modify above script mentioned in STEP 3 as per your data and requirement. In our case the report data is with column as “sum_travel_cost”. Also make sure you inject both of the above script separately and not at a time.
Thank You,
Helical Insight.