COGNOiSe.com - The IBM Cognos Community

Planning & Consolidation => COGNOS Planning => Topic started by: jimicron on 22 May 2007 11:38:48 AM

Title: Select date range once to apply to entire macro?
Post by: jimicron on 22 May 2007 11:38:48 AM
Hi - my first post, but hoping someone out there can help me as this would be a HUGE help to many of us where I work.

Currently, I have a macro in which I lock or unlock several cubes within the macro.   Basically, every cube in the model (around 20-25) are locked or unlocked. This happens at least one time per month.  The date range at the time of running the macro is the same for all 20-25 cubes.  It is for the historic dates through the present.  Therefore, the following month, the macro will be run again, but it will now include the latest month, which last month did not have - follow me on that?   :)

Here is an example of the process/macro:

@Message("Please select Months that you want to lock.  All Months selected will be locked.","O")
@DCubeOpenSelect({Selection from D-Cube Library Name.Cube Name1}; {D-list Library.4 Months})
@DCubeCommand("lock"; "ALL";{Selection from D-Cube Library Name.Cube Name1})
@Close("Y")
@Message("Please select Months that you want to lock.  All Months selected will be locked.","O")
@DCubeOpenSelect({Selection from D-Cube Library Name.Cube Name2}; {D-list Library.4 Months})
@DCubeCommand("lock"; "ALL";{Selection from D-Cube Library Name.Cube Name2})
@Close("Y")
etc

This 4 step process is repeated 20-25 times.  As you can probably guess, takes a little while to select the dates each time. 

I am wondering this:  Is there a way to select a date range once each time the macro is run that will then apply to every DCubeOpenSelect that is in the macro so I do not have to manually select 20-25 times?  Remember, this date range will change each time the macro is run, but not within the macro.

I sure hope someone has a workaround or a way to do this.  Thanks a lot!
JIM
Title: Re: Select date range once to apply to entire macro?
Post by: ykud on 22 May 2007 12:47:54 PM
Try @AddLocalPreselection.
Title: Re: Select date range once to apply to entire macro?
Post by: jimicron on 22 May 2007 04:02:49 PM
I tried this, however, it was a "hardcode."  It didn't bring up the option for me to select when I ran the macro.  I need something that will be brought up to select each time I run the macro.  For this to work, I have to go in prior to running the macro each time and select the months. 
Title: Re: Select date range once to apply to entire macro?
Post by: ykud on 22 May 2007 11:19:44 PM
Then try @SliceCommand and Parameter Cubes.
Title: Re: Select date range once to apply to entire macro?
Post by: jimicron on 23 May 2007 09:12:19 AM
Pardon me - pretty new to Cognos - so I do not understand "Parameter Cubes" - would you mind elaborating a little bit?  Thanks a lot!  I am assuming it will allow the selection I want as I have tried the Slice one before and it was like the other - hardcoded.  But I am curious about the "Parameter Cubes".  Thanks!
JIM
Title: Re: Select date range once to apply to entire macro?
Post by: ykud on 23 May 2007 09:36:22 AM
Sorry, that was some kind of slang.
You can define a number of cubes for latter slicing (for example, Months_to_Update Cube). They'll be used as Lookups in @SliceCommand or @SliceUpdate. They can be n-dimensional, but 2-dimensional slices are used for value selection.

See Analyst Help on @SliceUpdate -- there's a really nice example.