Author Topic: Default Selection  (Read 6212 times)

Offline cognostechie

  • Statesman
  • ******
  • Join Date: Jul 2005
  • Posts: 1,652
  • Forum Citizenship: +133/-7
    • Pervisol
Default Selection
« on: 31 Jan 2011 07:16:45 pm »
Trivial question for most of you  ;)

I have a Value Prompt for selecting the Year. I want the default selection to be the current year. Is there a way to tell RS to determine the current year ? Wrap an HTML item around the Prompt? or sort it descending and set the focus to the first item? any other way?

Thanks !

Offline Prit

  • Statesman
  • ******
  • Join Date: Oct 2010
  • Posts: 450
  • Forum Citizenship: +16/-1
  • Sharing Knowledge and Ideas
Re: Default Selection
« Reply #1 on: 31 Jan 2011 08:42:30 pm »
there r quite a few work around though...

Pls have a look at the below link and see if it helps?

http://www.cognoise.com/community/index.php/topic,9773.msg32101.html#msg32101


Thanks
P

Offline melee

  • Community Leader
  • *****
  • Join Date: Oct 2010
  • Posts: 95
  • Forum Citizenship: +4/-0
  • Running on the steam of apathy
    • Beautiful Data with COGNOS and jQuery
Re: Default Selection
« Reply #2 on: 01 Feb 2011 02:02:11 pm »
Trivial question for most of you  ;)

I have a Value Prompt for selecting the Year. I want the default selection to be the current year. Is there a way to tell RS to determine the current year ? Wrap an HTML item around the Prompt? or sort it descending and set the focus to the first item? any other way?

Thanks !

PRIT makes a good suggestion. Here's mine though, in case you're looking for a direct answer.

http://nicbertino.com/?p=48

Offline cognostechie

  • Statesman
  • ******
  • Join Date: Jul 2005
  • Posts: 1,652
  • Forum Citizenship: +133/-7
    • Pervisol
Re: Default Selection
« Reply #3 on: 01 Feb 2011 03:57:50 pm »
Thanks PRIT and melee. I used PRIT's  suggestion and this one also works:

getFormWarpRequest()._oLstChoicesyear.selectedIndex = 1;

Sort the prompt descending so 2011 comes up on the top so it selects that.

I still have a problem. The prompts are on the report page so first time the report opens, the filter has to use the current year to filter the data. I don't want to use promptbuttonfinish() because it won't let the user choose the year again.

Offline melee

  • Community Leader
  • *****
  • Join Date: Oct 2010
  • Posts: 95
  • Forum Citizenship: +4/-0
  • Running on the steam of apathy
    • Beautiful Data with COGNOS and jQuery
Re: Default Selection
« Reply #4 on: 01 Feb 2011 04:15:51 pm »
What version are you on?

Offline cognostechie

  • Statesman
  • ******
  • Join Date: Jul 2005
  • Posts: 1,652
  • Forum Citizenship: +133/-7
    • Pervisol
Re: Default Selection
« Reply #5 on: 01 Feb 2011 04:49:29 pm »
8.4   I am using a cube package. What expression would I use to filter the report for current year when it is run 1st time and then filter it based on what is selected from the Prompt.
The extract(year,current_date) won't work with cube package.

Offline cognostechie

  • Statesman
  • ******
  • Join Date: Jul 2005
  • Posts: 1,652
  • Forum Citizenship: +133/-7
    • Pervisol
Re: Default Selection
« Reply #6 on: 01 Feb 2011 07:16:37 pm »
I got it to work one way (either way) but not with a combination.

Created a data item with the expression - lastchild([ReportPeriod]) where [ReportPeriod] is the member from the tree. The name of this data item is 'Period' and the value will be the latest year.

Filter =

(?DatePrompt? < '' and [Date Dimension].[Year] = [Period])

OR

(?DatePrompt? > '' and [Date Dimension].[Year] = ?DatePrompt?)

Doesn't give any syntax error but still shows value that belong to an earlier Year

 



       
Twittear