Quickie: Changing default option in a Select and Search Prompt

I’ve been somewhat negligent in responding to the comments lately. One of the most common questions appears to be how to change the default option in a select and search prompt.

The following should work for all versions of Cognos.

Put an HTML item before the prompt, with the expression:

<div id="mySnS">

Now put another HTML item after the prompt with the expression:

</div>
<script>
/* Select and search options
 * 2 - Starts with any of these keywords * DEFAULT
 * 3 - Starts with the first keyword and contains all of the remaining keywords
 * 4 - Contains any of these keywords
 * 5 - Contains all of these keywords
 */
document.getElementById('mySnS').getElementsByTagName('input')[5].click();
</script>

The script will locate the mySnS element that surrounds the prompt, generate an array of the input tags, and click() on the one specified. In the example, 5 is selected so it will click on the sixth element (0 based array).

Going through the Cognos JavaScript files, it looks like there is supposed to be a function in the new Prompt API that would let you do it in an easier manner, unfortunately it appears to be an incomplete function, maybe it will be released in the new fixpack.

In theory, you should be able to do something like the following:

var acme = {};
acme.getControl = function(promptName)
{
  var ocr = cognos.Report.getReport("_THIS_");
  return ocr.prompt.getControlByName(promptName);
};

acme.getControl('mySnS2').setProperty( "caseInsensitive", false);
acme.getControl('mySnS2').setProperty( "searchType", "containsAny");

But, as I said, the function doesn’t appear to be complete in this version. Use the other method for now.

Blatant self promotion

As I wrap up some of my existing contracts, I realize I have some spare time coming up. Far be it from me to goof off in my spare time (the alternative being cleaning and other house work, and I can’t let the wife get used to that idea), I’d much rather be solving problems people are having with their Cognos set up.

So, does your company need help building that new dashboard for the CFO? Are the reports running too slowly over your new OLAP server? Does JavaScript make your brains leak out? Drop me a line at cognospaul@gmail.com and we can come to an arrangement.

#ibmiod Wednesday

Dynamic Cubes was the word of the day for me. It’s an exciting new feature of Cognos that lets you build cubes on top of relational systems. By using these cubes, you can get tremendous improvements in your report runtimes. The method of building them seems fast and easy, and while I have a few minor misgivings about some of the design decisions, I am really looking forward to getting an opportunity to play with them.

At the most basic level, Dynamic Cubes are an extension of the DQM engine. As I’m sure everyone in the world is aware, DQM is the 64bit querying engine released with Cognos 10.1. They are based on relational data sources, and work by caching the contents of your data warehouse.

First the cube needs to be modeled. I didn’t get a chance to see the cube modeler, but the developers are saying it looks and feels very similar to a cleaned up Transformer. Attributes can be defined (sadly lacking in Transformer), and dynamic dates are easy to build. It is important to note that the new modeling tool is far less forgiving for nonsense than Transformer. MUNs must be unique, or it will throw an error. The data warehouse must be set up in a star schema or a snowflake for the cube to work.

Once the cube has been built and published, it needs to be started. After it starts up it will start building the various caches. The member cache consists of all of the members in the dimension tables. Aggregation caches are populated as the cube runs. These can be contextually aware aggregates, so the cube will benefit if you have aggregated tables. The data cache is populated as reports are run. If a report has been run before, it will be in the cache and will be rendered instantly. An expression cache exists – any matching expression will be populated instantly.

As reports are run, it will be possible to determine if the aggregations used are optimal. The dynamic query analyzer has a new option for the cubes. You can have it check the run history for specific reports, or users, and it will optimize the caches aggregations to ensure the best performance.

The developers responsible for this innovation referenced a case study in which a report that took roughly a day to run went down to 3 seconds. From what I understand, the data warehouse was the same, but they needed to add some more ram.

The dynamic cubes take a fair amount of ram. IBM will release a white paper discussing the various sizing and ram requirements.

It seems that real life is creeping it’s way back in. Today was the final day of the Expo, and unfortunately I didn’t have a chance to meet with all of the people manning the booths. Over the next week I’ll try to go over the remaining documentation that I pulled from various booths.