I have a report with one variable setted as "Request from user"; it is configured as a list of two values; so when I render the report, it opens the dialog and ask the user to select one of the values for the variable.
I need to export report by code only after the user has filled in the value for that variable, so I imagined to use report events.
My idea was to use onShowReport event and check the value of the variable to see if execute the export portion of code or not.
But I have an issue getting the current value of the variable.
Here is my code:
Code: Select all
viewer.onShowReport = function (event) {
var variable_vettore = report.dictionary.variables.getByName("Vettore");
variable_vettore_txt = variable_vettore.value;
if(variable_vettore_txt !== null && variable_vettore_txt !== '') {
// export code here
console.log('export');
} else {
// do nothing
console.log('wait');
}
}
Where do I'm worng? Or there is a completly different approach to my idea?
With thanks,
Matteo