My ODBC data contains data in different columns e.g:
Jan_Sales Feb_Sales Mar_Sales
100 500 650
I want to pass the DB Field name as a Parameter in my TI Process so that I don't have to write many processes for each month or to run the same process by making changes in each time.
Can I create a parameter pMonth=Jan_Sales and then use it within the CellPutN function?
something like CellPutN(pMonth,'myCube',Dim1, Dim2, Dim3,'sales');
Please help!
Passing Data field name as Parameter in TI
- LoadzaGrunt
- Posts: 72
- Joined: Tue May 26, 2009 2:23 am
- Version: LoadzaVersions
- Excel Version: LoadzaVersions
Re: Passing Data field name as Parameter in TI
For a source table that contains many months worth of data, you could have something similar to this in the Data tab of your TI:
Code: Select all
CellPutN(Jan_Sales,'YourCube',Dim1,Dim2,Dim3,'Sales');
CellPutN(Feb_Sales,'YourCube',Dim1,Dim2,Dim3,'Sales');
CellPutN(Mar_Sales,'YourCube',Dim1,Dim2,Dim3,'Sales');
...
-
- Posts: 103
- Joined: Mon Sep 21, 2009 7:09 pm
- OLAP Product: Cognos Tm1
- Version: 10.2.2
- Excel Version: 2016
Re: Passing Data field name as Parameter in TI
I actually want to load the data on monthly basis, that is why I don't want to add multiple CellPutN() in my Data tab.
Is there any other suggestion or something which I can do using the Parameters?
Is there any other suggestion or something which I can do using the Parameters?
- Steve Rowe
- Site Admin
- Posts: 2456
- Joined: Wed May 14, 2008 4:25 pm
- OLAP Product: TM1
- Version: TM1 v6,v7,v8,v9,v10,v11+PAW
- Excel Version: Nearly all of them
Re: Passing Data field name as Parameter in TI
The best I can suggest is to use an if statement
If (pMonth@='Jan');
valueToLoad=col1;
ElseIf (pMonth@='Feb');
valueToLoad=col2;
etc
Else (pMonth@='Dec');
valueToLoad=col12;
End;
CellPutN (valueToLoad, Cube ,etc);
I don't there is way to say use a parameter to declare a column as the one you interested in.
HTH
Steve
If (pMonth@='Jan');
valueToLoad=col1;
ElseIf (pMonth@='Feb');
valueToLoad=col2;
etc
Else (pMonth@='Dec');
valueToLoad=col12;
End;
CellPutN (valueToLoad, Cube ,etc);
I don't there is way to say use a parameter to declare a column as the one you interested in.
HTH
Steve
Technical Director
www.infocat.co.uk
www.infocat.co.uk
-
- MVP
- Posts: 3233
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Passing Data field name as Parameter in TI
I tried many many variations of the EXPAND function, but could not make it work...
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
- Steve Vincent
- Site Admin
- Posts: 1054
- Joined: Mon May 12, 2008 8:33 am
- OLAP Product: TM1
- Version: 10.2.2 FP1
- Excel Version: 2010
- Location: UK
Re: Passing Data field name as Parameter in TI
I have
Each column of data in my source from V11 to V239 represents a different month. I have an attribute that denotes month 1 = jan 2009, Month 2 = Feb 2009 etc so i can relate the columns in the data source to the attributes. This means when the date range of the file changes, all we need to do is ensure the control attributes reflect the same range before we import the data.
What the code above does is equate the variable name (starting at V11) to a month number from the control cube (eg. V11 = Month 1 = Jan 2009). The CellPut statement uses "ATTRS ( ' Month Number ', MonthS , ' Demand Month ' )" to know what month i'm loading to, and the EXPAND line allows me to grab the VALUE from the relevant column. It means for each line of data in my source file, i actually load 228 datapoints. The normal way TI works is to load just one datapoint per line.
The person who wrote the original TI didn't know how to do this and so wrote the same CellPut statement 228 times
I needed to edit it and find / replace wouldn't have dealt with the needed change, so rather than go through all that manually i did some research to find a far better way of writing it 

Code: Select all
MonthN = 1;
VarN = 11;
While ( MonthN <= 228 );
MonthS = 'Month ' | NumberToString ( MonthN );
VarS = EXPAND ( '%V' | NumberToString ( VarN ) | '%' );
What the code above does is equate the variable name (starting at V11) to a month number from the control cube (eg. V11 = Month 1 = Jan 2009). The CellPut statement uses "ATTRS ( ' Month Number ', MonthS , ' Demand Month ' )" to know what month i'm loading to, and the EXPAND line allows me to grab the VALUE from the relevant column. It means for each line of data in my source file, i actually load 228 datapoints. The normal way TI works is to load just one datapoint per line.
The person who wrote the original TI didn't know how to do this and so wrote the same CellPut statement 228 times


If this were a dictatorship, it would be a heck of a lot easier, just so long as I'm the dictator.
Production: Planning Analytics 64 bit 2.0.5, Windows 2016 Server. Excel 2016, IE11 for t'internet
Production: Planning Analytics 64 bit 2.0.5, Windows 2016 Server. Excel 2016, IE11 for t'internet