COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: CognosAdmn on 01 Mar 2010 09:09:08 AM

Title: Prompt for measures in line chart
Post by: CognosAdmn on 01 Mar 2010 09:09:08 AM
Hello everyone,

I was wondering if its possible (in Cognos 8.2) to build a chart report that would enable the user to select the measure fields from a dropdown box?

Currently I have three line charts where each has two measures in the "Series" box. I would like to set up a single line chart report with a dropdown box with three choices to select from. Each selection needs to have two measures in the Series box though.

Any help or advice will be greatly appreciated.

Title: Re: Prompt for measures in line chart
Post by: CognosPaul on 01 Mar 2010 01:51:56 PM
It is possible.

Create a data item, called Measure, with the following function:
#prompt('pMeasure','token','defaultmeasure')#
The default measure should be the measure from the insertible field list. [NS].[Measure].[Sales] for example.

Place that data item into the chart as needed.

Create a value prompt with static values, remember to set autoprompt or to add a reprompt button.

Display    | Use
-----------+------------------------
Sales      |[NS].[Measure].[Sales]
Revenue    |[NS].[Measure].[Revenue]
Profit     |[NS].[Measure].[Profit]


When the user selects a measure Cognos will place the use value into the data item, just as if you put it there originally.

I have given a basic description of token prompts here: http://www.cognoise.com/community/index.php/topic,9015.0.html (http://www.cognoise.com/community/index.php/topic,9015.0.html)
Title: Re: Prompt for measures in line chart
Post by: CognosAdmn on 01 Mar 2010 09:50:12 PM
Thank you for taking the time to help me out Paul.

I've resolved this problem using conditional formatting with a conditional block. A problem I encountered is with the Use and Display names. If i set a more user friendly name for the Display, the report only runs the default chart. If i set the same names for both Use and Display then the report displays the chart selected in prompt. Your solution sounds more interesting and quicker. I will give your suggestion a try first thing in the morning.

Thank you again.

Shaam
Title: Re: Prompt for measures in line chart
Post by: paddhu on 01 Mar 2010 11:16:41 PM
QuoteI've resolved this problem using conditional formatting with a conditional block. A problem I encountered is with the Use and Display names. If i set a more user friendly name for the Display, the report only runs the default chart. If i set the same names for both Use and Display then the report displays the chart selected in prompt.

I suppose this is because of the condition you have specified for the conditional block. Check the expression for the associated condition variable, whether it uses ParameterDisplayValue() or ParameterValue(). Both are different as their name suggests and uses the Display/Use values of the prompts respectively.
Title: Re: Prompt for measures in line chart
Post by: CognosAdmn on 03 Mar 2010 08:18:09 AM
Awesome tip Paddhu. That did resolve my problem. Thanks so much for your help.  :D
Title: Re: Prompt for measures in line chart
Post by: jmsellner on 03 Mar 2010 09:08:05 AM
You can also use this with a map.
Title: Re: Prompt for measures in line chart
Post by: CognosAdmn on 03 Mar 2010 11:01:22 AM
With a map?  :-\
Title: Re: Prompt for measures in line chart
Post by: jmsellner on 03 Mar 2010 01:02:46 PM
If you are doing a report that uses a map instead of a chart you can use this same prompt soultion to apply different measures to the map.
Title: Re: Prompt for measures in line chart
Post by: CognosAdmn on 03 Mar 2010 01:46:07 PM
Thats good to know Jim. Thank you.  :)
I will keep that in mind when I get a requirement for a report with map. And if I get stuck, i know who to bug.  ;)
Title: Re: Prompt for measures in line chart
Post by: BobaGreek on 12 May 2011 01:45:13 PM
Dear PaulM,

For some reason your approach doesn't work for me. I am using Cognos 8.4. My default measure displays the item information, but not the value.

Example: Masure item contains [NS].[Measure].[Sales], not the actual sales numbers.

Any ideas?