Please help with Expand Function

Post Reply
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Please help with Expand Function

Post 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;

pandinus
Posts: 78
Joined: Tue Mar 18, 2014 8:02 am
OLAP Product: TM1, Cognos Express
Version: 10.2.2
Excel Version: 2013

Re: Please help with Expand Function

Post 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.
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: Please help with Expand Function

Post by Ashleigh W »

thank you Pandinus. That saved me sometime.
lotsaram
MVP
Posts: 3652
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Please help with Expand Function

Post 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.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
User avatar
Steve Rowe
Site Admin
Posts: 2416
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: Please help with Expand Function

Post by Steve Rowe »

+1 From me, would be a massive step forward in the utility of TI.
Technical Director
www.infocat.co.uk
Wim Gielis
MVP
Posts: 3113
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Please help with Expand Function

Post by Wim Gielis »

Exactly. This, and also an implementation of the concept of arrays.
Best regards,

Wim Gielis

IBM Champion 2024
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
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Please help with Expand Function

Post 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.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
David Usherwood
Site Admin
Posts: 1453
Joined: Wed May 28, 2008 9:09 am

Re: Please help with Expand Function

Post 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.
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Please help with Expand Function

Post 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.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Wim Gielis
MVP
Posts: 3113
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Please help with Expand Function

Post 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.
Best regards,

Wim Gielis

IBM Champion 2024
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
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Please help with Expand Function

Post 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
TIDevelopmentModel.jpg (121.94 KiB) Viewed 9269 times
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
User avatar
Steve Rowe
Site Admin
Posts: 2416
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: Please help with Expand Function

Post 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).
Technical Director
www.infocat.co.uk
User avatar
Alan Kirk
Site Admin
Posts: 6606
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Please help with Expand Function

Post 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... :twisted:
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
BrianL
MVP
Posts: 264
Joined: Mon Nov 03, 2014 8:23 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2 PA2
Excel Version: 2016

Re: Please help with Expand Function

Post 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.
BrianL
MVP
Posts: 264
Joined: Mon Nov 03, 2014 8:23 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2 PA2
Excel Version: 2016

Re: Please help with Expand Function

Post 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.
Post Reply