Dynamic Prompting based on User Selection
In this month’s Tech Tips we’ll run through a demo on how to display dynamic prompts based on user selection. This is especially useful if you want to offer a lot of functionality in a report without confusing the user with a myriad of unnecessary prompting. Hidden prompts will appear when the user makes specific selections in other prompts.
From a high level perspective: We’ll be creating numerous cascading prompts, creating a conditional variable and then conditionally rendering some of these cascading prompts based on the variable we created.
The following demo was created using the Cognos 8.4 Go Sales(Query) package
1. Create a simple list report from the Inventory(query) namespace with optional filters – product line code, product type code, product brand code, product number. Add a required filter “Year”.
2. Create a prompt page with following cascading prompts:
Product Line
Product Type – cascading source is Product Line
Product – cascading source is Product Type
Product Brand – cascading source is Product Type
3. Create a conditional variable called show brand. Define the value “Y” if the production line code equals “991”, which happens to correspond to Camping Equipment. Have it default to “N”
4. Go back to the Prompt page, add a conditional block and set it to use show brand as its block variable.
5. Select the conditional block, set the Current Block property to “N” and then drag the Product prompt into conditional block. When the show brand variable is “N” the report user will see this Product prompt.
6. Set the Current Block property to “Y” and copy the Product prompt into conditional block again. Then add a new Product Brand prompt. Set Product Brand’s cascade source to Product Type and Product’s cascade source to Product Brand. Now when the Show Brand variable is “Y” (Camping Equipment was selected) then you will see both of these prompts.
7. Test and run report.
If a user selects Camping Equipment from the Product Line prompt, then Product Type, Product Brand and Product filter will be shown for further filtering.
If a user selects any other product line then the Product Brand prompt will be hidden. Only the Product Type and Product prompts will be shown for further filtering.