Custom Variables in Report

Hi,

You can add following code into the On Load event of the first slide:

if (!prez.initReport) {
    prez.initReport = true;
    var fOldReport = prez.formatReportData;
    prez.formatReportData = function(data, format) {
        var result = fOldReport.call(this, data, format);
        var isObject = typeof result == 'object';
        if (!isObject) {
            try {
                var json = JSON.parse(result);
                result = json;
            } catch (ex) {
                alert('The report is not a valid JSON');
                return result;
            }
        }
        result['customId'] = prez.variable('variable_name'); //Replace this line
        return isObject ? result : JSON.stringify(result);
    }    
} 

Regards,

1 Like