Note that there are some explanatory texts on larger screens.

plurals
  1. POIn Cognos BI, how do I select first/last element of a dropdown parameter to be the default?
    text
    copied!<p>I've racked my brain trying to find an easy way to do this and I think I'm going to have to resort to a programmatic solution (if that's even possible).</p> <p>I'm using Cognos BI 8.4 and have a query set up to retrieve all distinct dates from my database table. I also have some parameters for the report which uses that query to populate two value prompts, one each for start and end date.</p> <p>What I need is to have the first date in the list be the default (in the case of the start date parameter) or the last date in the list (for the end date parameter). For example, if the dates in the table range from <code>2011-01-15</code> to <code>2011-06-03</code>, the start date parameter should default to the former and the end date parameter should default to the latter.</p> <p>I can set defaults to specific known values but, since the list is the result of a query, I don't know the values in advance. If I use <code>1970-01-01</code> for the default start date, it doesn't set it to the earliest date, it just ignores that value altogether.</p> <p>What I get on the parameter screen is something like this:</p> <pre><code> +-------------+ +-----------+ Date range: | From date |V| | To date |V| +-------------+ +-----------+ +-------------+ +-----------+ Yellow/red: | 70% |V| | 90% |V| +-------------+ +-----------+ </code></pre> <p>You can see that the yellow and red thresholds populate okay since they're static content (<code>50</code> through <code>100</code> in steps of <code>5</code>), not dynamic. Because I <em>know</em> that certain values exists for that dropdown, I can set the default to a static value, like <code>70</code> or <code>90</code>.</p> <p>However, as mentioned, the dynamic parameters do <em>not</em> act this way, instead reverting to the "no default selected" view if the default I try to set is not in the query which populated the dropdown.</p> <p>How do I set the default to a query-specific value rather than a static one. With BIRT, I just had some Javascript code run after the query to change the ROM slots based on the data retrieved. Does Cognos BI have a similar way of doing things (and, if so, what is it)?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload