Topic
  • 2 replies
  • Latest Post - ‏2013-10-25T03:37:43Z by Ba-al
kgcognos
kgcognos
17 Posts

Pinned topic How to setup drop down values

‏2013-10-24T18:42:17Z |

I need a value prompt for my year parameter.
The drop down should show only 2 years based on the current month.
If current month < Oct, it should show current year and previous year.
If current month >= Oct, it should show current year and next year. 

We are new to COGNOS, we don't have a time dimension setup yet so I cannot reference a member.

How and where can I setup my required years and setup the prompt to display these years?

Thank you in advance.

  • OpherB
    OpherB
    696 Posts

    Re: How to setup drop down values

    ‏2013-10-24T19:05:39Z  

    There are three ways to populate values into a prompt:

    1) A query against the data source. Since you don't have the needed information in a database, this probably won't work.

    2) Static Choices allow you to define the values as constants...but you want the prompt to change based on external conditions, so this probably won't work.

    3) How good is your JavaScript?

    Good luck,
    Opher

     

  • Ba-al
    Ba-al
    51 Posts

    Re: How to setup drop down values

    ‏2013-10-25T03:37:43Z  
    • OpherB
    • ‏2013-10-24T19:05:39Z

    There are three ways to populate values into a prompt:

    1) A query against the data source. Since you don't have the needed information in a database, this probably won't work.

    2) Static Choices allow you to define the values as constants...but you want the prompt to change based on external conditions, so this probably won't work.

    3) How good is your JavaScript?

    Good luck,
    Opher

     

    1. Create 2 queries in the report.

       1: One data item with current_year formula

       2: One data item with formula like

    case when Month >Oct then current_year -1 else current_year +1 end

    Then make a union for these queries. Use this union as a source for prompt.

    2. Static Choices

    Add a condition block based on boolean variable (value of current_month < Oct).

    Add 2 DropDowns on block. First - current year and previous year for True and current year and next year for False.

    But you should change values in this approach every year. So first way will be better.