Page 1 of 1
Please help with Expand Function
Posted: Mon Feb 06, 2017 10:28 am
by Ashleigh W
Hi everyone, please help with Expand Function. I'm trying to build dynamic/indirect varible and assign a value to it. Got some example from tm1forum.com itself but wont work for me. It says syntax error simicolon missing..
please advice. thanks!
Code: Select all
ixDim=1;
While ( ixDim<=100);
Expand ('%sElName' | numbertostring(ixDim) | '%') = numbertostring(ixDim);
ixDim=ixDim+1;
End;
Re: Please help with Expand Function
Posted: Mon Feb 06, 2017 10:59 am
by pandinus
With EXPAND you:
- can only assign a dynamic value to a variable.
- cannot make the variable name itself dynamic.
edit:
In case you really really really would like dynamic variable names including dynamic values you're best of building a temporary cube to hold the information.
Re: Please help with Expand Function
Posted: Mon Feb 06, 2017 11:30 am
by Ashleigh W
thank you Pandinus. That saved me sometime.
Re: Please help with Expand Function
Posted: Mon Feb 06, 2017 3:37 pm
by lotsaram
pandinus wrote:With EXPAND you:
- can only assign a dynamic value to a variable.
- cannot make the variable name itself dynamic.
edit:
In case you really really really would like dynamic variable names including dynamic values you're best of building a temporary cube to hold the information.
This is one of the major limitations IMO of using Expand. I for one would LOVE to be able to use Expand on the LHS of a variable declaration. It would save a lot of tedious lines of prolog code of nothing more than establishing variables for use in processes with dynamic datasources with number of data source variables only known at runtime.
If it's possible it would be a great enhancement.
Re: Please help with Expand Function
Posted: Tue Feb 07, 2017 9:26 am
by Steve Rowe
+1 From me, would be a massive step forward in the utility of TI.
Re: Please help with Expand Function
Posted: Tue Feb 07, 2017 6:00 pm
by Wim Gielis
Exactly. This, and also an implementation of the concept of arrays.
Re: Please help with Expand Function
Posted: Tue Feb 07, 2017 7:35 pm
by Alan Kirk
Wim Gielis wrote:Exactly. This, and also an implementation of the concept of arrays.
I
would agree (along with For loops to get rid of the (sometimes forgotten) bloody counter variable in While loops, and increment / decrement operators, a real debug mode, an IDE that is worth a damn and pretty much any other construct that has been available in most mainstream programming languages for the past quarter of a century), but bitter experience has told me how that will go.
(a) "If you need arrays, you can make a call to a Java process! That in
no way stinks up and overcomplicates maintenance and documentation of your code base!"; or
(b) "Temporary dims and temporary cubes were good enough array substitutes for mah gran'pappy when he were usin' TM1 to manage his cattle russlin' in th' Wyoming Territory in 1883, it should be good enough for you!"
With the exception of a handful or two of functions to deal with new server functionality and the aforementioned Java calls, I can't think of any significant changes
to the language itself since... pretty much ever.
Re: Please help with Expand Function
Posted: Tue Feb 07, 2017 9:06 pm
by David Usherwood
@Alan, you will doubtless be delighted to know that for Planning Analytics 2.0, released in December 2016, IBM make available a Java-based debugger tool:
https://developer.ibm.com/recipes/tutor ... -debugger/
I'm choosing my words carefully as I believe that, since it is not part of the main install, it is not fully supported.
I have tried it and it appears to work - although, with Dells with fonts set to other than 100%, the 'password' box does not show, which is something of a showstopper in use.
Re: Please help with Expand Function
Posted: Tue Feb 07, 2017 10:53 pm
by Alan Kirk
David Usherwood wrote:@Alan, you will doubtless be delighted to know that for Planning Analytics 2.0, released in December 2016, IBM make available a Java-based debugger tool:
https://developer.ibm.com/recipes/tutor ... -debugger/
I'm choosing my words carefully as I believe that, since it is not part of the main install, it is not fully supported.
I have tried it and it appears to work - although, with Dells with fonts set to other than 100%, the 'password' box does not show, which is something of a showstopper in use.
Yes, I was aware of that one. I should have chosen my own words more carefully as well so as to include that but it was why I qualified it as a "real" debug mode. I
believe (since I have yet to install PAL) that this allows you to view various values as you step though.
But (and I'll be quite happy if I'm wrong about this) I don't believe that it allows you to step through
AND edit the code
AND dynamically assign values within a complete IDE in the style of Eclipse, the Visual Basic Editor, Visual Studio, etc, etc.
Like the Java function calls, it's like bolting another engine on the side of a car's chassis instead of redesigning the car to accommodate a complete engine that does everything you need.
And, indeed, everything that a whole bunch of other engines have been doing for the past couple of decades.
Re: Please help with Expand Function
Posted: Wed Feb 08, 2017 12:20 am
by Wim Gielis
Alan Kirk wrote:But (and I'll be quite happy if I'm wrong about this) I don't believe that it allows you to step through AND edit the code AND dynamically assign values within a complete IDE in the style of Eclipse, the Visual Basic Editor, Visual Studio, etc, etc.
Correct, it won't do that. Still I found it useful and timesaving the couple of times I used it in day-to-day TM1 (TI) work.
Re: Please help with Expand Function
Posted: Wed Feb 08, 2017 12:45 am
by Alan Kirk
Wim Gielis wrote:Alan Kirk wrote:But (and I'll be quite happy if I'm wrong about this) I don't believe that it allows you to step through AND edit the code AND dynamically assign values within a complete IDE in the style of Eclipse, the Visual Basic Editor, Visual Studio, etc, etc.
Correct, it won't do that. Still I found it useful and timesaving the couple of times I used it in day-to-day TM1 (TI) work.
I kinda figured it wouldn't...

- TIDevelopmentModel.jpg (121.94 KiB) Viewed 11251 times
Re: Please help with Expand Function
Posted: Wed Feb 08, 2017 8:36 am
by Steve Rowe
Just a few more comments about the debugger, this probably has to be the most side-tracked thread ever so far??
1. Believe it to be a standalone piece of java that doesn't require PAW, I think it has to be a fairly recent TM1 version or the correct API calls don't exist under the hood. I think it works with 10.2.2. (untested). So if you are on maintenance I guess you could download PA and just use the debugger if you aren't ready to take the plunge.
2. Whilst you can't create a new TI in the app you can edit one. (untested).
Re: Please help with Expand Function
Posted: Wed Feb 08, 2017 10:23 am
by Alan Kirk
Steve Rowe wrote:Just a few more comments about the debugger, this probably has to be the most side-tracked thread ever?.
"Ever" ain't over yet...

Re: Please help with Expand Function
Posted: Wed Feb 08, 2017 1:39 pm
by BrianL
Wim Gielis wrote:Alan Kirk wrote:But (and I'll be quite happy if I'm wrong about this) I don't believe that it allows you to step through AND edit the code AND dynamically assign values within a complete IDE in the style of Eclipse, the Visual Basic Editor, Visual Studio, etc, etc.
Correct, it won't do that. Still I found it useful and timesaving the couple of times I used it in day-to-day TM1 (TI) work.
Not quite. You can edit TI existing
code (unfortunately neither datasource/variable definition, nor new process creation), but not while actively debugging a process. You can also change the values assigned to a variable manually in the UI, but not dynamically via script. While it's certainly not a full fledged IDE, I personally think it covers all the critical bits of functionality.
Re: Please help with Expand Function
Posted: Wed Feb 08, 2017 1:40 pm
by BrianL
Steve Rowe wrote:
1. Believe it to be a standalone piece of java that doesn't require PAW, I think it has to be a fairly recent TM1 version or the correct API calls don't exist under the hood. I think it works with 10.2.2. (untested). So if you are on maintenance I guess you could download PA and just use the debugger if you aren't ready to take the plunge.
It does not require PAW, and the new (docuemented REST) APIs are only available on PA2.