Array variables

Suggest and discuss enhancements for TM1
Post Reply
jstrygner
MVP
Posts: 195
Joined: Wed Jul 22, 2009 10:35 pm
OLAP Product: TM1
Version: 9.5.2 FP3
Excel Version: 2010

Array variables

Post by jstrygner »

I would love to have array variables available in TI.

Instead of:

Code: Select all

sElement1=DimNm('Dimension', 1);
sElement2=DimNm('Dimension', 2);
...
sElementN=DimNm('Dimension', N);
I could use

Code: Select all

i=1;
While (i<=N);
  sElement[i]=DimNm('Dimension', i);
  i=i+1;
End;
User avatar
Steve Rowe
Site Admin
Posts: 2410
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: Array variables

Post by Steve Rowe »

Hmm isn't a cube an array already?
When I have needed an array in TI I've built the cube in the prolog and then deleted it in the epilog.

I've attached the TI code for building an array here.

Code: Select all

#Reference to 2d cube with one dimension containing indexes.

i=1;
While (i<=N);
  CellPutS('zArrayCube', str(i, 10,0), '1')=DimNm('Dimension', i);
  i=i+1;
End;

Sorry to jump on your posts! ;)
Technical Director
www.infocat.co.uk
jstrygner
MVP
Posts: 195
Joined: Wed Jul 22, 2009 10:35 pm
OLAP Product: TM1
Version: 9.5.2 FP3
Excel Version: 2010

Re: Array variables

Post by jstrygner »

Yes, Steve, I could create/delete cubes to have the functionality I need.

I think I just misunderstood the "Enhancement" term :-)
This way there is not much place for enhancements in TM1, because you can find workarounds for many, many problems.

Just as a short explanation, such array variables would improve my prolog code for drilling processes I implemented for one of our customers that uses 9.1, where we have the 256 string variable length limitation. The process was called by users (cause it is a drilling process) and to make it work proper I would need to create and delete 8 cubes every time any user calls such a drilling process (or one huge cube that is of a size of my "longest" possible dimension, but then I would need to change my SELECT command to something really unpretty).

The general idea of this solution was described here:
http://applixforum.olapforums.com/viewP ... adID=15395

Now the 256 limit is not a problem, so my enhancement was appropriate for older versions.
Sorry to jump on your posts! ;)
Yes, I will re-think 5 times before I'll put an enhancement post. ;) Or wait, I'll just PM you for review before submitting ;)
User avatar
Steve Rowe
Site Admin
Posts: 2410
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: Array variables

Post by Steve Rowe »

Hi jstrygner,

Feel free to post as you please, your opinion is just as valid as mine! It wasn't my intention to imply that what you suggest would not be useful or beneficial, I was just trying to point out workarounds.

As you say with TM1 there are often workarounds becasuse the direct method you imagine exists doesn't, but it's not up to me to judge what IBMs priorities should be when we talk about enhancements here, even assuming IBM come here

Cheers
Technical Director
www.infocat.co.uk
Post Reply