Danny Gargus, June 12, 2023
With the release of Cognos Analytics 12 comes the addition of a new Parameters Page in Report Authoring. In my opinion this has been a long time coming. There is a wide variety of impressive things you can do with the parameters now, so let’s take a look at what has been added.
In Reporting, prior to Cognos 11 versions, it was difficult to change anything related to the parameter without deleting and recreating one. Then in Cognos 11 versions we got the ability to swap parameters for a prompt and rename them and such. Now, with the release of Cognos 12, we have a dedicated page where we can create all the parameters we need beforehand without creating prompts first.
If you’re like me and always start building the queries before putting fields in a list or crosstab, this is a very handy page because you have more control upfront about what the parameter types are and how they’re going to be used.
Get the Best Solution for
Your Business Today!
Table of Contents
Parameter Page
Let’s look first at where we can find the Parameter Page. It is located as part of the navigation in reporting at the top of the page and is available at the bottom of the list when you first open Report Authoring.
After selecting Parameters, we are taken to the new page that looks similar to the other pages that we have where the Insertable Objects are on the left and the list of created parameters is on the right. Near the top of the page on the list side are two tabs – Defaults and Found. At this point, I am unclear why the first tab is named Defaults, but this is the area where we can create our parameters and we have several different types to choose from which should all be familiar.
Notice that we aren’t worried about the type of prompt we are using, and most of these can apply to more than one prompt type which we can worry about later. Parameters can be created by dragging from the Insertable Objects pane to the Parameters canvas or by selecting the ‘+’ (Add) button and selecting the type you want. A dialog box opens and allows you to change the name. Now, here’s where it gets interesting.
Let’s select the Found tab at the top of the page. I purposefully created a value prompt on my page canvas and assigned a parameter to it just like I used to do. Notice that it does not show up in the Defaults tab. But it does show up in the Found tab as an available parameter.
That, in itself, isn’t unexpected. What had caught me off guard was, back in the Defaults tab, when I create a new String parameter, I can select the previously created “found” parameter and it adds it to the Defaults tab. I assumed I would get an error message that it already exists or something of that nature.
So now it exists in both tabs. But changing the name of the parameter to ‘p_value_prompt111’ in the Defaults tab automatically creates a new parameter in the Found tab. This is because ‘p_value_prompt’ is already assigned to an actual Value Prompt on my report page. Notice that my new parameter does not have a value in the Set by field.
From the Found tab I cannot change the name of a parameter, nor are there any properties associated with them. In fact, I cannot even select a row. What I can do though is click the link in the Set by column and Cognos takes me to the location where my prompt resides which is very handy especially if you have multiple tabs with prompts or multiple prompt pages.
OK, let’s back up a bit. I hit undo a couple of times and have my Parameters Page set up where I have ‘p_value_prompt’ in both the Defaults and Found tabs. I want to change the name of the parameter at the prompt (which I have been able to do since at least version 11) and see what happens. I changed the name to ‘p_value_prompt222’ which shows on my page now.
When I navigate back to the Parameters Page, I see on the Defaults tab that I still have ‘p_value_prompt’. But in the Found tab, I now have two parameters – ‘p_value_prompt’ that is presumably tied to the row in the Defaults tab, and a new one with the updated name that I gave it. Notice that the value in the Set by column has moved from ‘p_value_prompt’ to ‘p_value_prompt222’ and my original parameter is not assigned to anything anymore.
To experiment a little more, I added the default value ‘abcd’ to my parameter ‘p_value_prompt’ on the Defaults tab. This doesn’t change anything on the Found tab, which is good. I also changed the Type property of the parameter to a Date instead of a String. This action cleared my default value which is also a good thing since ‘abcd’ is not a date. But changing the Type from a String to a Date also removed the parameter from the Found tab so now I only have my modified ‘p_value_prompt222’ parameter left. I am unclear as to why this happens.
If I create a new String parameter on the Defaults tab (called ‘Parameter1’), it also shows up on the Found tab. I now have on the Defaults tab ‘p_value_prompt’ and ‘Parameter1’ and on the Found tab ‘p_value_prompt222’ and ‘Parameter1’. I can add ‘p_value_prompt222’ to the Defaults tab like I showed earlier but I cannot add ‘p_value_prompt’ to the Found tab. I thought I might get it to show up by assigning it to a new prompt, but when I created a new test box prompt on my page, I only got the options for the parameters in the Found tab.
It seems I may have inadvertently created an orphan because I have no option to add a default value anymore and I have no options of anything to do with this parameter. I also get a different message about selecting a default value.
A fine message except that I cannot define a default value and have no option to assign it anywhere, so I believe my only option is to delete it.
If you have a required prompt and you validate your report, you know that it will prompt you for a value so that it can validate the report. Assuming all is successful, and you have supplied a valid argument, your value will show up under the Value column after validation for any parameters that are used.
In this case my value is ‘Blue’. If I want to clear all parameter values, I can choose the option in the top right – Clear parameter values. But I also have the option to clear individual parameter values with a “minus” icon next to each parameter which is handy if you are testing and want to change one of the values that you are testing with.
Default Values
We touched on these some, but I wanted to expound on these a little. After entering a default value for the prompt (‘Orange’ in this case), when I opened the default selection property again, I noticed a message that I had missed the first time that the property has been deprecated. I have the option to move the default selection to the Report Parameters Page.
Clicking the option to Move to Report Parameters automatically created the parameter in the Defaults tab (it wasn’t there before – only in the Found tab) and added my default value.
When I navigate back to the Report Page, I now have no value under the Default selections property anymore. I also noticed that my default value for my prompt (‘Orange’) didn’t have any effect on the Value column in the Found tab for the same parameter (‘Blue’). So you can test with a different value than your default which is nice.
Another great feature of the Default Values relates to dates. In earlier versions it was a hassle to try to get a default date to show up in a prompt so we resorted to JavaScript and trickery to achieve the results. Now though we can use a query to define any dates we want and then assign those values to the date parameter we have created.
Once I have created my date parameter click the ‘+’ button at the bottom of the right-hand pane and add a Default value. We get options for a single value or a range of values. If you select Value it takes you right to the window where you can assign a query and select your field or you can pick a default date by hitting the hamburger button next to Text.
If you select a Range Value you will first get the option to use the min and max values for the parameter. You will have to activate one or both of these to save a default value. If you turn them both on and hit OK without entering anything it’s the same as if you didn’t do anything and the defaults will not be saved. You must hit the hamburger button or double click the empty space to open the window and either assign a query value to it or select a single date. Once you select the dates they will appear in your window and you can hit OK to finish.
Being able to assign a query value is great because you can do all of the date logic in your query and then just assign the values!
Conclusion
The Parameters Page may take some time to get used to – especially how the Defaults and Found tabs work together. Once you have mastered the basics though, I believe it will be a time-saver to use the full capabilities of this feature and applaud IBM for adding it to the application.
We hope that you found this article both interesting and informative. If you have any additional questions on the Parameters Page, or anything else regarding the Cognos 12 upgrade, contact us today! Be sure to also subscribe to our Newsletter for more PMsquare articles, updates, and insights delivered directly to your inbox.
To explore leveraging the new Parameters view/function to provide default parameter values in scheduled reports and other more advanced techniques, check out the newest article on Dynamic Default Prompt Parameters.