Setting the default search type in Cognos 11 interactive mode

The search prompts haven’t gone through many changes in Cognos since version 8. Despite many requests, changing the default search type (from starting However, one big whopping change is the popup element containing the search items is no longer inside the search control. Instead it’s hidden somewhere else on the page, with nothing tying it to the actual control.

This makes the old script useless, and finding that popup is incredibly difficult. In Cognos 11.1 the method for finding the popup is promptElement._FZH._9FF while in 11.0 it’s promptElement._REG._FZD. This obfuscation means we have to rely on trickery and shenanigans.

Look away now if you value your sanity

prmptElmLoop: //yes I'm using a label here. I'm not feeling at all defensive about it.
  for(var a in  $(prmptElm).find('.clsComboBox')[0]){
    
    if(typeof($(prmptElm).find('.clsComboBox')[0][a])=="object" ){ //if the object itself is an object...
      for(var b in $(prmptElm).find('.clsComboBox')[0][a]){ //...dig deeper.
        if($(prmptElm).find('.clsComboBox')[0][a][b].classList=="po_clsListView_dropdown po"){ //this identifies the actual popup element. 
          $($(prmptElm).find('.clsComboBox')[0][a][b]).find("tr:eq("+(opt-1)+")").trigger('mousedown'); //finds the correct table row and performs a mousedown. 
          if(resizeOptions) prmptElm.style.width='unset';
          break prmptElmLoop;
        }
        
      }
    }
    else continue;

  }

In order to find that options popup, we’re looping through the prompt element and examining each attached method. If it’s an object, we go deeper. Finally we’ll find a method that’s a pointer to the element (which we can identify using the class), and then it’s just a matter of triggering a mousedown event on the correct row.

In order to use it, you need to give the search prompt a name, like mySnS. The custom control needs to have the following configuration:

{
"promptName": "mySnS",
"option": 2,
"resizeOptions": true
}

That’s looking for the prompt name mySnS, selecting “Starts with the first keyword and contains all of the remaining keywords”, and then resizing the options list.

The options are as follows:
* 1 – Starts with any of these keywords * DEFAULT
* 2 – Starts with the first keyword and contains all of the remaining keywords
* 3 – Contains any of these keywords
* 4 – Contains all of these keywords

Important note! I’ve tested this on 11.0.5 and 11.1.0. I have no reason to think it won’t work on other C11 versions but I can’t promise it will continue working. Hopefully methods like this will be exposed with a consistent name in future versions.

The attached zip contains the report XML and the JavaScript.
search-Default.zip (34 downloads)

RFE Roundup November, 2018.

As a new feature of my blog, I’ll periodically list a number of interesting new (and some old) RFEs that should be added to the product. I’m not including any that are listed as Delivered or Duplicate, but Declined and Planned For Future Release are both game.

Since this is the first RFE Roundup, and because I’m the one writing it, let’s go through the most important RFEs first. My RFEs.

1. Use library tab in Admin to store JavaScript Controls

Under Consideration with 79 votes.

There are a number of reasons we would want Cognos to store the JavaScript controls. With the controls stored in a governed location, we can add security to them. We can have documentation and example configurations stored WITH the control. We could have a control picker, just like we have with visualizations. And most importantly I’d like to be able to extend the controls out to dashboards.

2. Enable advanced drill behavior in interactive mode

Uncommitted candidate with 11 votes.

I really can’t understand why this was removed. The advanced drill options made it possible to maintain a specific set function when drilling. You could see the top ten states in a country, and then drill down to see the top ten cities. They were also used to create a breadcrumb trail when drilling down. As it stands now, when you drill down you see everything.

3. Improvements to the Assistant AI

Uncommitted Candidate with 11 votes.

The new assistant AI in 11.1 is pretty cool. But it could be so much better. I want to be able to have deep philosophical debates with it, while I have it do all of the repetitive administrations tasks I am too lazy to do myself. Imagine being able to tell them AI to perform a rolling restart of the dispatchers. It should also be able to have a master dataset allowing more general questions to be asked of it.

4. Search prompt without refreshing page

Under Consideration with 6 votes.

This really bothered me. When version 11 first came out, the search prompts returned the results without refreshing the page. It was awesome! I had a nice sliding prompt pane that contained a search prompt, and everything was perfect. And then tragedy. IBM reverted the behavior to match C10. Searching in the prompt refreshed the page. Cue doom and gloom and whinging from all quarters (specifically from one Cognos Developer I could name, but I’m far too modest to talk about myself).

5. Improvements to Drill Throughs

Submitted with 5 votes.

Cognos has a solid way of linking from report to report, but drills haven’t been touched in ages. I’d like to be able to change the value being passed directly in the definition. Or even pass a static value. The RFE also includes a few suggestions for adding drill through related changed to the JavaScript API. In a previous article I wrote about modifying the drill options, changing the format of the drill or even the drill target. The drill options have been obfuscated in Interactive Mode, rendering that article useless.

Now let’s look at RFEs from people who aren’t named Paul.

6. Ability to save Dashboard/Story for offline use

Under Consideration with 10 votes.

I’d love to see Stories be used more often. Imagine if we could export stories to PowerPoint, with the animations intact.

7a. Allow Custom Sorting of contents like Folders, Reports and Packages

Uncommitted Candidate with 221 votes

7b. Allow custom Sorting of Report Folders and Reports like in 10.2.2

Declined with 344 votes.

Why do we even need to ask for this? Default sorting wasn’t used everywhere, but when it was used it was important.

8. Ability to control interactive mode on list/charts/crosstabs level

Uncommitted Candidate with 23 votes.

For the most part, I find the interactivity offered to users is more of an annoyance than anything else. Especially when building complex graphs and crosstabs. I think it stems from not trusting the vast majority users to know how to properly explore their data.

9. BRING back the Report Editor Toolbar and Menu (as in Report Studio)

Declined with 14 votes.

I’ve whinged about this before, and I’ll whinge about it again. I don’t like the focus on making it harder to find options and buttons. There are still a number of things that are impossible to do without the toolbar. Try building a report in structure mode, for example.

10. Homogenize prompt dialogs all over the product

Under Consideration with 13 votes.

The prompts throughout Cognos are beginning to show their age. Having a standardized template for prompts, identical across the various tools, would make the experience a lot easier for users.