I have a report that works fine on first opening, but on any subsequent opening it reverts to the default parameters for its data.
I have two windows. Window A has a button that opens Window B, passing in three parameters. Window B contains a Report Viewer pointed at my report. The three parameters of the report are attached to Window B’s parameters using the Property Binding.
The very first time Window B opens, the report uses the parameters as designed. Works great. Window B has a “Close” button to close that window. I’ve even used the script: system.nav.closeParentWindow(event) and the result is the same.
When I then use Window A to open Window B again (with new or same parameters passed in), the Report Viewer does not get the Window B parameters passed in. I have debugged it out and saw that the Window B parameter are correct, but the Report Viewer parameters are set to “None”.
I don’t have any other odd or special scripting. The Report uses a Tag History query with a couple of time series charts. Nothing out of the ordinary.
I’m thinking I need to manually set the Report Viewer properties and then refresh it upon Window B open, but that kinda defeats the purpose of binding its parameters.
My notes on the ticket said that I had luck using a script to change the value of the custom property and then changing the value back. This would have to be done after the report loads, and there’s no way to get that event with a script, so it would either have to be a button on the screen or use a delay that will hopefully be long enough. Wish I had a more elegant idea for you…
I’ve tried to use Client tags attached to my Report Viewer parameters, instead of passing in parameters through the window and that did not work. Curiously, when I would bind the Report Viewer parameters to Client Tags, it would work once and then also detach and not work again until I manually reset the binding. It would show it was bound, but had no value.
So my next route was to just skip all that and use Client tags as default values for my Report parameters (done directly in the report designer). That appears to be completely non-functional.
No, because reports are executed on the Gateway. They should work as overrides in the Vision component or client scripts.
In 7.8.1 we’ve removed the client tags from the tag selection tree when you are setting up report parameters in the reporting workspace, so that you won’t be tempted to use them.
I’ve also tried wrapping the Report Viewer in a template, thinking that may help, and possibly using the template repeater to create a “fresh” instance of the control when the page opens, but there’s no love on that approach (yet).
It seems like the Report Viewer will not stay bound to parameters unless it’s tied directly to a control object on the same screen (like a date picker). That works for a few simple reports here and there, but I’ve got bigger plans than that.
Okay, so wrapping the Report Viewer in a Template and using the Template Canvas DID work. I can now launch the report repeatedly and it renders correctly each time.
You have to catch the event for “componentRunning” on the Canvas and then setup the dataset to feed it, which includes your wrapped Report Viewer Template and the parameters you need to pass in.
Not the most elegant solution, but a solution nonetheless!