If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Default prompt selection not applied to LIST

Started by actcognosuser, 29 Apr 2016 09:40:00 AM

Previous topic - Next topic

actcognosuser

Hello C10 Users,

The default  selection for value prompt is latest date.
I am using javascript to select latest value in the prompt.
When report is generated, latest date is selected in prompt but not in the list report.

navissar

your script is probably not doing what you think it's doing. Hard to know more than that based on the data provided.

actcognosuser

Thank you for the response Nimrad.

The javascript below selects the latest date as the display, bUt the value is not applied to the list.List shows all the dates.

<script type="text/javascript">
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if (fW)
{
if (fW._oLstChoices<fieldname>.length > 1) // modify this line to ==1 to only execute if ONLY one value
{
// NOTE: In some case the zero should be changed to 2 (to skip the header on the prompt and
// select the actual 1st value.
fW._oLstChoices<fieldname>.selectedIndex = 0;
// if the report is running from reportStudio or the Portal objects are different
if (fW.elements["cv.id"].value == "RS")
setTimeout('oCVRS.promptAction(\'finish\')', 100);
else
setTimeout('oCV_NS_.promptAction(\'finish\')', 100);
}
}
</script>

Since the datasource is cube, an alternate approach used was slicer.
Specified default selection as MUNfor current date and added the slicer below:

#prompt( 'ParameterName', 'MUN', '
Member Unique Name [Cube].[ Date].[Current Day].[Current Day]->:[PC].[@MEMBER].[Current Day]
' ) #

Below is the list format:

            CurrentDay  WTD QTD MTD YTD
01/01   20                20      20   20   20

When slicer is applied Period to date also shows same value as current date.


bdbits

Your prompt macro syntax is not correct.
#prompt('name','datatype','default','pretext','source','posttext')#

So maybe you need something like
#prompt( 'ParameterName', 'memberuniquename', '[Cube].[ Date].[Current Day].[Current Day]->:[PC].[@MEMBER].[Current Day]' )#

actcognosuser

Thank You for your response bdbits.

But the result is still the same.

Default selection works(current day) and when a different sate is selected the measures for that date are populated right.

But the wtd MTD YTD numbers as same as date selected. Is there a way to get around this issue? i.e after the day is selected the wtd ,mtd,ytd should be calculated dynamically?

navissar

OK, there are a lot of things here. Let's tackle them one by one.

Quote from: actcognosuser on 03 May 2016 08:45:27 AM
Thank you for the response Nimrad.

The javascript below selects the latest date as the display, bUt the value is not applied to the list.List shows all the dates.

<script type="text/javascript">
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if (fW)
{
if (fW._oLstChoices<fieldname>.length > 1) // modify this line to ==1 to only execute if ONLY one value
{
// NOTE: In some case the zero should be changed to 2 (to skip the header on the prompt and
// select the actual 1st value.
fW._oLstChoices<fieldname>.selectedIndex = 0;
// if the report is running from reportStudio or the Portal objects are different
if (fW.elements["cv.id"].value == "RS")
setTimeout('oCVRS.promptAction(\'finish\')', 100);
else
setTimeout('oCV_NS_.promptAction(\'finish\')', 100);
}
}
</script>

Right. That script does select the 1st value of a drop down and then clicks on finish, although it does that pretty terribly.
How is that parameter used? Is that a detail filter?

Quote from: actcognosuser on 03 May 2016 08:45:27 AM
Since the datasource is cube, an alternate approach used was slicer.

You should use a dimensional function or a slicer (Depending on what you are reporting on) no matter how you get that latest date default. Also, A list with a dimensional source isn't recommended - Cognos has to pull all the data, and essentially flatten it to look like relational, and that can lead to unexpected results. So I'd try to refrain from that too.

Quote from: actcognosuser on 03 May 2016 08:45:27 AM
Specified default selection as MUNfor current date and added the slicer below:

#prompt( 'ParameterName', 'MUN', '
Member Unique Name [Cube].[ Date].[Current Day].[Current Day]->:[PC].[@MEMBER].[Current Day]
' ) #

Below is the list format:

            CurrentDay  WTD QTD MTD YTD
01/01   20                20      20   20   20

When slicer is applied Period to date also shows same value as current date.



Based on this, I'd build the report like this:
A crosstab. On columns your CurrentDay, WTD, MTD and YTD values.
On rows a data item with your MUN prompt with the default value. The data item will always return one date - the selected/default date.

actcognosuser

Hello Nimrod,

Thank You for the response and Pardon my ignorance.

Did you mean having the dataitem instead of the prompt in slicer?I added the dataitem as a nested
row with my measure. it did not work.

Desired Output for currentday/any selected day would look like:

Crosstab Rows     CurrentDay  MTD   QTD    YTD
Revenue                  20              34      100     200
Costs Incurred        10              20        50      100


With prompt selection , current output is
Crosstab Rows     CurrentDay  MTD   QTD    YTD
Revenue                  20              20     20        20
Costs Incurred        10              10      10      10

Datasource is Cube.

navissar

I think the problem is you are trying to get the date dimension in twice: Once as a "Filter" and once as the columns. When you filter based on one date, obviously you won't be able to see the rest of them. What I'd do is work the selected date into the relative date calculations in the columns.

actcognosuser

Hello Nimrad,

I have used an alternate solution for period to date values.i.e calculating measures
based on week ,month and year(ex: total(revenue for month)).
Then passing the results to another query where date filter is applied.It works fine now.

filter expression

Date=(if (?Parameter? = 'DefaultSelection') then (current_date) else (?Parameter?))

Thank you for all your inputs