Our Blog

Animated checkbox searches in Cognos

One of the reasons for my slowdown in posts, is an increased workload. Fortunately, despite the occasionally bizarre requests I receive, sometimes I get one that is fun. The latest being my client wanted a multiselect autosuggest feature.

Here’s an example of autosuggest features that can be done in Cognos. It works fine, but the issue with that is that it uses the display value, and you can only select one option at a time.

Instead, since I’m incredibly lazy and don’t want to any more work than absolutely necessary, I thought about merging my techniques of Searching a Checkbox and Animating Dropdown Prompts.

Like the previous solutions, this is also an easy addition.

In general, I try to avoid adding extraneous HTML items, but unfortunately there is no decent way of identifying a prompt object in versions prior to 10.2. A checkbox prompt, when using the normal API, will return a set of its options. If there aren’t any options, fW._oLstChoicesPromptName will return nothing. So, despite my better judgment, wrapping the prompt is required. Also, due to the way certain browsers handle select objects (I’m looking at you, IE), this will only work with radio and checkbox prompts.

First, copy main JavaScript into the header of the report. As usual, that contains all of the necessary functions. This doesn’t reference the new Prompt API, so it will work in all versions after 8.4. Next, give your prompt a name, and wrap it in a div with the same id. Finally, create a new HTML item to call the function for each prompt.

layout

If everything works correctly, and everything should work perfectly on the first try, this being Cognos, you should get similar results.

searching searching

The attached report was built on 10.2.1 on the Sales and Marketing cube, but it should downgrade cleanly to previous versions by changing the schema number in the XML. Have any questions about this? Email us at info@performanceg2.com or fill out the comment box below.

Main Javascript.xml

Report.xml

This entry was posted in Technical Concepts and Ideas, Tips and tricks and tagged , , , . Bookmark the permalink.

Comments are closed.

PerformanceG2 Menu