COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: knivskarp on 31 Aug 2015 09:19:19 AM

Title: Value prompt for grouped variables
Post by: knivskarp on 31 Aug 2015 09:19:19 AM
Hi everyone,

I have a pretty simple question (I think) :

What is the best and easiest way for me to do if I want to create a Value prompt inside a report which is based on a numeric variable?

Lets say I have a variable [SCORE] which is a numeric variable with values between 1-100. I want to use this variable to create a Grouped variable, Say [GROUPED_SCORE] and then use this variable to slice my list report.

What is the best and easiest way for me to succed with this? Should I create a new query or should I stick to the query which my list is based on?


Thanks in advance,

/Knivskarp
Title: Re: Value prompt for grouped variables
Post by: bdbits on 02 Sep 2015 01:53:51 PM
Dimensional or relational? This is very pertinent to your question.

I'm not entirely clear. You want to filter your data to one particular score? Or do you want to group your data based on ranges of scores? e.g. '1-20', '21-40', '40-50', etc.


Title: Re: Value prompt for grouped variables
Post by: knivskarp on 07 Sep 2015 02:00:17 AM
Hi, it´s relational.

I want to filter my data on a range of scores, e.g '1-20', '21-40', '40-50' etc. as you mentioned.

What is the best and most correct way to succed with this?

Thanks in advance,

Knivskarp
Title: Re: Value prompt for grouped variables
Post by: MFGF on 07 Sep 2015 04:38:51 AM
Quote from: knivskarp on 07 Sep 2015 02:00:17 AM
Hi, it´s relational.

I want to filter my data on a range of scores, e.g '1-20', '21-40', '40-50' etc. as you mentioned.

What is the best and most correct way to succed with this?

Thanks in advance,

Knivskarp

Hi,

In that case you'd create a Value Prompt and use the "Static Choices" property to define the prompt values you require

eg
Use Value a, Display Value 1-20
Use Value b, Display Value 21-40
Use Value c, Display Value 41-50
Use Value z, Display Value 51+

You could then code your filter using the following approach

(?Your Parameter? = 'a' and [your Score item] between 1 and 20) OR (?Your Parameter? = 'b' and [your Score item] between 21 and 40) OR (?Your Parameter? = 'c' and [your Score item] between 41 and 50) OR (?Your Parameter? = 'z' and [your Score item] >= 51)

Cheers!

MF.
Title: Re: Value prompt for grouped variables
Post by: knivskarp on 09 Sep 2015 05:59:32 AM
Hi,

Thanks for your answer! This works for this grouped Score problem, but another problem showed up (In the same dataset, relational):

I want to filter a date variable with a Value Prompt in the same way.
The date variable is in the format ( YYYY-MM-DD ), and I would like to filter my list report with a new created variable (Only with YYYY-MM).
I could use the same procedure as with the grouped score case, but this means i have to add a static choise for every new month coming in.

Is there any other smart solution if I want to filter my data on this YYYY-MM variable?

Thanks in advance,
knivskarp