Welcome to the new CogKnowHow.com!


If you have trouble logging in, reset your password via the login window
by clicking the 'Forgot Password' link.

Mdl script to automate changing date range in Dimension


#1

I have the following script that updates the earliestdate in my Model file (pyj or mdl). The problem is I have >50 model files I need to update these dates on and I have to update them quarterly changing the earliest and latestdate by 3 months each quarter.
So currently it is set to 20150401 thru 20170331

Next month I will need this to shift forward to 20150701 thru 201700630

Here is my current code to automatically change the dates:
I am currently using Cognos 10.2.1.
I am looking for a way to pass a value based off of today’s date through to my code below:

 OpenPy "\\path_to_my_file\filename.pyj"
 DimUpdate "DimensionName"
 DimType Date EarliestDate 20150701
 DimType Date LatestDate 20170630
 SavePy "\\path_to_my_file\filename.pyj"

I cannot figure out IBM’s language to do this. I have searched high/low on IBM’s site but cannot seem to figure out an automated way to do this.

Ultimately something like this; but %let does not work:

 %let earlydate=today()-730;
 %let late date=today()
 
 OpenPy "\\path_to_my_file\filename.pyj"
 DimUpdate "DimensionName"
 DimType Date EarliestDate &earlyldate 
 DimType Date LatestDate &latedate
 SavePy "\\path_to_my_file\filename.pyj"

Any ideas?