TM1 TI Variable question
-
- Posts: 6
- Joined: Thu Aug 21, 2014 1:19 pm
- OLAP Product: TM1
- Version: 10.2.2
- Excel Version: 2010
TM1 TI Variable question
Hi, I'm trying to create a TI process that imports data from a text file, easy enough. The issue I'm having is that I need to transform one of the fields into 2, seperating the month from the year. I have this field vDate, sample value is 20160401121024. I need to transform that into the year '2016' and the month 'Apr-16'. To do this in the variable tab I've changed vDate to Other, added a new variable called vYear with the formula vYear=subst(vDate,1,4); and for the month I've used the following formula
vMonth=if(subst(vDate,5,2)@='01','Jan-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='02','Feb-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='03','Mar-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='04','Apr-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='05','May-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='06','Jun-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='07','Jul-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='08','Aug-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='09','Sep-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='10','Oct-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='11','Nov-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='12','Dec-'|subst(vDate,3,2),''))))))))))));
When I look on the variable screen, it seems to resolve properly, that is, it shows Apr-16. The issue I'm having is that when I run the TI, I get an error message that says
Data Source line (1) Error: Data procedure line (20): Invalid key: Dimension Name: "Month", Element Name (Key): ""
It looks like the Month is not resolving like it shows in the variable tab
Any thoughts?
vMonth=if(subst(vDate,5,2)@='01','Jan-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='02','Feb-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='03','Mar-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='04','Apr-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='05','May-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='06','Jun-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='07','Jul-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='08','Aug-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='09','Sep-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='10','Oct-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='11','Nov-'|subst(vDate,3,2),
if(subst(vDate,5,2)@='12','Dec-'|subst(vDate,3,2),''))))))))))));
When I look on the variable screen, it seems to resolve properly, that is, it shows Apr-16. The issue I'm having is that when I run the TI, I get an error message that says
Data Source line (1) Error: Data procedure line (20): Invalid key: Dimension Name: "Month", Element Name (Key): ""
It looks like the Month is not resolving like it shows in the variable tab
Any thoughts?
-
- Site Admin
- Posts: 1458
- Joined: Wed May 28, 2008 9:09 am
Re: TM1 TI Variable question
asciioutput the vdate field to see what's coming through.
Better, though, would be to set up aliases for the month dimension showing (eg) 0116 against Jan-16 - then you can just use subst(vdate, 3,4) for the month and you don't need your twelve nested ifs.
(Why is the year showing in the month dimension, btw?)
Better, though, would be to set up aliases for the month dimension showing (eg) 0116 against Jan-16 - then you can just use subst(vdate, 3,4) for the month and you don't need your twelve nested ifs.
(Why is the year showing in the month dimension, btw?)
-
- Posts: 6
- Joined: Thu Aug 21, 2014 1:19 pm
- OLAP Product: TM1
- Version: 10.2.2
- Excel Version: 2010
Re: TM1 TI Variable question
Thanks for the response. I knew I was going to get called out on the Year and Month-Yr dimensions
. We'll either be removing the year dimension or modify the Month-Yr to be just Month Hadn't thought about the alias on the Month, I'll check that out.
When I do any asciioutput I just see " "

When I do any asciioutput I just see " "
-
- Site Admin
- Posts: 1458
- Joined: Wed May 28, 2008 9:09 am
Re: TM1 TI Variable question
Then you have a problem with your data source....When I do any asciioutput I just see " "
-
- Posts: 18
- Joined: Wed Sep 30, 2015 12:40 pm
- OLAP Product: TM1
- Version: 9.5.2+
- Excel Version: 2007
Re: TM1 TI Variable question
If the code you're having an issue with is in Prolog or Epilog, the variables are not available as they happen before and after the datasource is processed.
Emily Wilkins - Software Engineer
Motio, Inc.
Motio, Inc.
-
- MVP
- Posts: 1828
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: TM1 TI Variable question
The OP shows the error is seen in the data tab.jwilkins wrote:If the code you're having an issue with is in Prolog or Epilog, the variables are not available as they happen before and after the datasource is processed.
The error is a result of whatever is pulled through in the record for the date not having its substring as between 01 and 12. As David has suggested it is certainly an issue with the datasource which could be a number of things; due to it being on the very first record I would hazard an initial guess that it could be set to not skip the header rows... but only the OP can check the datasource and work out what it actually is.
Declan Rodger
-
- Site Admin
- Posts: 1458
- Joined: Wed May 28, 2008 9:09 am
Re: TM1 TI Variable question
Prolog variables are available in the Data tab - would be less than useful if they were notIf the code you're having an issue with is in Prolog or Epilog, the variables are not available as they happen before and after the datasource is processed.

-
- MVP
- Posts: 2836
- Joined: Tue Feb 16, 2010 2:39 pm
- OLAP Product: TM1, Palo
- Version: Beginning of time thru 10.2
- Excel Version: 2003-2007-2010-2013
- Location: Atlanta, GA
- Contact:
Re: TM1 TI Variable question
Indeed. but what I think he meant is that you can't build a variable in the prolog that is based off anything in the data source. If the OP's code were in the prolog it would never work.David Usherwood wrote:Prolog variables are available in the Data tab - would be less than useful if they were not
-
- Posts: 18
- Joined: Wed Sep 30, 2015 12:40 pm
- OLAP Product: TM1
- Version: 9.5.2+
- Excel Version: 2007
Re: TM1 TI Variable question
Ah, I must have glossed over that. Good catch. You are clearly much more observant than I am.declanr wrote:The OP shows the error is seen in the data tab.

Exactly what I meant.tomok wrote:but what I think he meant is that you can't build a variable in the prolog that is based off anything in the data source.
Emily Wilkins - Software Engineer
Motio, Inc.
Motio, Inc.
- jim wood
- Site Admin
- Posts: 3958
- Joined: Wed May 14, 2008 1:51 pm
- OLAP Product: TM1
- Version: PA 2.0.7
- Excel Version: Office 365
- Location: 37 East 18th Street New York
- Contact:
Re: TM1 TI Variable question
Agreed, as you already hinted towards Tom the prolog executes before the data source runs so the variables defined within the data would never be available in prolog. I thought I'd mention that as I wasn't sure if the OP knew it. It's one of those that makes sense once you know.tomok wrote:Indeed. but what I think he meant is that you can't build a variable in the prolog that is based off anything in the data source. If the OP's code were in the prolog it would never work.David Usherwood wrote:Prolog variables are available in the Data tab - would be less than useful if they were not
Struggling through the quagmire of life to reach the other side of who knows where.
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Shop at Amazon
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7