Using reports events and variables doubt
Posted: Thu May 31, 2018 10:05 am
Hello,
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:
it never run the export code part also after the user has choosen the value for the variable and re-submitted the report clicking on the submit button on the variable dialog.
Where do I'm worng? Or there is a completly different approach to my idea?
With thanks,
Matteo
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