Problem:
Hi,
is there a way to get javascript variables or one of the new “User Variables” in my report to JSON file ?
The problem is I need a custom ID-String in every Report which is generating in the presentation but I can’t get this string to submit…
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);
}
}
Wow, thank you - this works like a charm for AP7.
Do you see a way to adapt this for my “old” presentations, written in AP6 without the need to export every single project file trough AP7? I saw the onload event is fired in the rlprez.js - but there was no such a file in AP6 exports so I cant just paste it in.