July 28, 2016 Leave a comment
I successfully did this a couple of years ago, and realize that I should have shared it. I guess better late than never. Here’s a report example that shows you how it’s done:
Alter an Active Report Variable.xml
Once you open the report in Cognos Report Studio, you’ll need to change the package and the data source in the SQL query object. The SQL’s written for Oracle, but you can alter it for your own database.
- getElementByARId – This function, along with some start-up code at the end of the onload event allows us to quickly find objects we need to reference. An Alternative to getElementById for Active Reports will describe this in full.
- fireMouseDown – Takes a node in a radio button and simulates a click on that node. The three major browsers all need to do this differently.
- selectRBListValue – Finds the radio button group you want to affect (list), searches for the node you want to select (node), and attempts to click on that node. Since the timing of the creation of the many elements in an Active Report can be tricky, it attempts to click on the node four times.
The other elements are:
- A div tag (and closing tag) surrounding a button. This describes what to do when the button is clicked.
- A data drop-down list to show the results of the button being clicked.
- A div tag surrounding a data radio button group that we will use to manipulate the variable. This tag and its contents are hidden from the user’s view.
It looks like a lot, but once you understand how to implement it, this technique is fairly simple to deploy. It may have taken a long time for me to give this to you, but on the bright side, I can say that it has been tested thoroughly almost every business day for the last two years.