Applies To
SharePoint Online and SharePoint On-Premises
Description
This article describes the process of configuring NITRO Reports data using JavaScript in the configuration. Below are some use cases that require script in NITRO Reports
Use Case 1: How to put currency symbol in Report for currency column values in Table report.
Go to NITRO Report configured for the list –> Advanced settings –> Customize Report –> Add/Edit Script –> set the below script.
Script used below:
var scriptManager = {};
//Modify the chart properties. This is applicable for updating Charts like bar, column etc.
scriptManager.PreRenderCharts = function(objKendoChart, functionCallback){
//Modify objKendoChart properties.
functionCallback(objKendoChart);
};
//Render table report values. Val is the actual cell value in the below script. We need to configure JavaScript to set updated value depending on the requirement. In this case, we are setting the currency symbol $ before the cell value.
scriptManager.tableValueRender = function(val){
return "$"+val;
};
//Render table report Total X-axis values
scriptManager.tableTotalXRender = function(val){
return "$"+val;
};
//Render table report Total Y-axis values
scriptManager.tableTotalYRender = function(val){
return "$"+val;
};
return scriptManager;
Sample Report:

Use Case 2: How to scale the actual values in Millions or hundreds to avoid getting zeroes in Report

Script below is referring to reduce the actual value divided by 100 in this use case.
scriptManager.tableValueRender = function(val){
if(val === 0 || (val && !isNaN(val))){
return "$" + ((Number(val))/100);
}
return "$"+val;
};