Page 1 of 1

Array variables

Posted: Wed May 05, 2010 2:30 pm
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;

Re: Array variables

Posted: Wed May 05, 2010 3:30 pm
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! ;)

Re: Array variables

Posted: Thu May 06, 2010 10:00 am
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 ;)

Re: Array variables

Posted: Thu May 06, 2010 10:21 am
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