Avoid copying code á la Wim Gielis
Avoid copying code á la Wim Gielis
I use very much the method Wim Gielis, Avoid copying code.
But I still have not found any possibility that the n-fund on the shows of the n-variable inputs,
it would be an art activation.
I do not want to know how the variable is called but its content
I speak about a text input in a ti Process
Any idee ?
if you write +Param01+ in MDX, you mean the value of your Param01.
Is there anything comparable in TI ?
But I still have not found any possibility that the n-fund on the shows of the n-variable inputs,
it would be an art activation.
I do not want to know how the variable is called but its content
I speak about a text input in a ti Process
Any idee ?
if you write +Param01+ in MDX, you mean the value of your Param01.
Is there anything comparable in TI ?
Re: Avoid copying code á la Wim Gielis
where are our Gurus?
On vacation?
On vacation?
-
- Site Admin
- Posts: 1458
- Joined: Wed May 28, 2008 9:09 am
Re: Avoid copying code á la Wim Gielis
I wish 
I can't speak for others but I am afraid I don't have the faintest idea of what your posting was about - hence the lack of response.

I can't speak for others but I am afraid I don't have the faintest idea of what your posting was about - hence the lack of response.
-
- Posts: 1
- Joined: Thu Sep 09, 2010 2:35 pm
- OLAP Product: TM1 and C8
- Version: 9.5.1
- Excel Version: 2003
Re: Avoid copying code á la Wim Gielis
Do you want to place parameters or variables inside an mdx-expression in a ti process?
It works with string concatenation. If your parameter name is pCountry and you want to check if it is an element of your [countries] dimension, then use
TM1FILTERBYPATTERN({TM1SUBSETALL( [countries] )},'|'"'|pCountry|'"'|')}
Watch out for single and double apostrophes - the double apostrophes are only necessary because i used TM1FILTERBYPATTERN. Otherwise '|pCountry|' should be ok.
Hope that helps
It works with string concatenation. If your parameter name is pCountry and you want to check if it is an element of your [countries] dimension, then use
TM1FILTERBYPATTERN({TM1SUBSETALL( [countries] )},'|'"'|pCountry|'"'|')}
Watch out for single and double apostrophes - the double apostrophes are only necessary because i used TM1FILTERBYPATTERN. Otherwise '|pCountry|' should be ok.
Hope that helps
Re: Avoid copying code á la Wim Gielis
Thanks Drbot und David.
Short question:
how can I read data within a three loop from an input ?
Short question:
how can I read data within a three loop from an input ?
-
- Site Admin
- Posts: 6647
- 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: Avoid copying code á la Wim Gielis
Short answer: that question isn't any clearer than your first one.bskalli wrote:Thanks Drbot und David.
Short question:
how can I read data within a three loop from an input ?
- What input, exactly? From what source? Are we talking about a process parameter? A cube view as a data source? A Text file as a data source? A CellGetN/CellGetS statement somewhere in your code?
- What do you mean by a "three loop"? Are you talking about three nested While loops? A While loop that iterates three times? Something else? Is this loop within the Prolog? Or is it on the Data tab? Or is it on the Metadata Tab? Or is it something in an obscure corner of The Discovery Channel?
- What do you mean by "read" it given that if it's an "input" it is, by definition, already "read".
As the Request for Assistance Guidelines say,
Try to make the question as specific as possible.
"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.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Re: Avoid copying code á la Wim Gielis
Hello Alan,
I have a text-file as Data-Source with three variables.
I want to transfer the value of this variable within a loop.
I know that the last line is wrong:
MyDims='Column01§Column13§Column27§';
WHILE(LONG(MyDims)>0);
Column=SUBST(MyDims,1,SCAN('§',MyDims)-1);
x=+Column+;
the only solution I know is the following:
If (Colum@='Column01'); x=Column01;
ElseIf (Column@='Column13'); x=Column13;
ElseIf (Column@='Column27'); x=Colum27;
EndIf;
Hopful
I have a text-file as Data-Source with three variables.
I want to transfer the value of this variable within a loop.
I know that the last line is wrong:
MyDims='Column01§Column13§Column27§';
WHILE(LONG(MyDims)>0);
Column=SUBST(MyDims,1,SCAN('§',MyDims)-1);
x=+Column+;
the only solution I know is the following:
If (Colum@='Column01'); x=Column01;
ElseIf (Column@='Column13'); x=Column13;
ElseIf (Column@='Column27'); x=Colum27;
EndIf;
Hopful
- Michel Zijlema
- Site Admin
- Posts: 712
- Joined: Wed May 14, 2008 5:22 am
- OLAP Product: TM1, PALO
- Version: both 2.5 and higher
- Excel Version: 2003-2007-2010
- Location: Netherlands
- Contact:
Re: Avoid copying code á la Wim Gielis
Posting this code fragment doesn't make it much clearer what you're trying to establish...
I assume that the WHILE statement is followed somewhere in your code by an END statement.
I see that in the WHILE statement you check for the length of the MyDims string value - is this length reduced anywhere in the WHILE loop before the END statement? Otherwise the loop will never end.
The last statement you posted contains an invalid construct - what value exactly do yo want to assign to the x variable? If this needs to be the value of the Column variable (as per your first post in this thread) than x = Column; would be sufficient (where the variable Column will contain the value 'Column01' in the first iteration of your WHILE loop).
Michel
I assume that the WHILE statement is followed somewhere in your code by an END statement.
I see that in the WHILE statement you check for the length of the MyDims string value - is this length reduced anywhere in the WHILE loop before the END statement? Otherwise the loop will never end.
The last statement you posted contains an invalid construct - what value exactly do yo want to assign to the x variable? If this needs to be the value of the Column variable (as per your first post in this thread) than x = Column; would be sufficient (where the variable Column will contain the value 'Column01' in the first iteration of your WHILE loop).
Michel
-
- MVP
- Posts: 3230
- 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: Avoid copying code á la Wim Gielis
Hello
Michel is right, at the bottom of the code, the string should become smaller:
MyDims=DELET(MyDims,1,SCAN('§',MyDims));
And the WHILE loop should be closed with an END;
For those interested, check out the article on my website with the same name: "Avoid copying code".
bskalli,
I more or less understand what you are trying to do. Unfortunately, in TI you cannot "create" variables out of a text string. My method, however, can be used for many other loops, cases where statements are executed for a number of similar objects. There is no better workaround than what you were proposing in your (pseudo-)code.
Wim
Michel is right, at the bottom of the code, the string should become smaller:
MyDims=DELET(MyDims,1,SCAN('§',MyDims));
And the WHILE loop should be closed with an END;
For those interested, check out the article on my website with the same name: "Avoid copying code".
bskalli,
I more or less understand what you are trying to do. Unfortunately, in TI you cannot "create" variables out of a text string. My method, however, can be used for many other loops, cases where statements are executed for a number of similar objects. There is no better workaround than what you were proposing in your (pseudo-)code.
Wim
Last edited by Wim Gielis on Fri Sep 10, 2010 12:37 pm, edited 1 time in total.
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
Re: Avoid copying code á la Wim Gielis
Hello Wim, I know your code and I use it too.
You're the first who told me that there is no activation in TI.
I have my answer.
Hello Michel,
Of course there are a lot of code inside the loop,
Read attributes, arithmetic, writing in a cube ...
Thank you for your patience
You're the first who told me that there is no activation in TI.
I have my answer.
Hello Michel,
Of course there are a lot of code inside the loop,
Read attributes, arithmetic, writing in a cube ...
Thank you for your patience
Re: Avoid copying code á la Wim Gielis
Hello Wim, here is an example of your method without loop,
rather than one dimension to be defined with attributes.
CompanyCode='00301';
T_I='&00011&00013&00301&00338&';
T_O='&58012&58043&56002&56061&';
Firma=Subst(T_O,Scan(CompanyCode,T_I),5);
bskalli
rather than one dimension to be defined with attributes.
CompanyCode='00301';
T_I='&00011&00013&00301&00338&';
T_O='&58012&58043&56002&56061&';
Firma=Subst(T_O,Scan(CompanyCode,T_I),5);
bskalli
-
- MVP
- Posts: 3230
- 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: Avoid copying code á la Wim Gielis
You are right with the example.
Drawback is that maintenance is more difficult (changing an attribute is easier than going in the TI code - also permissions wise). Also, attributes cubes can be filled by rules for instance, here in the TI code it's hardcoded.
The loop idea can be used for fixed, rather random, enumerations, with which we will not do much in the TM1 model itself (as opposed to an alias for instance).
Thanks for reflecting on the hint I gave.
Wim
Drawback is that maintenance is more difficult (changing an attribute is easier than going in the TI code - also permissions wise). Also, attributes cubes can be filled by rules for instance, here in the TI code it's hardcoded.
The loop idea can be used for fixed, rather random, enumerations, with which we will not do much in the TM1 model itself (as opposed to an alias for instance).
Thanks for reflecting on the hint I gave.
Wim
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
Re: Avoid copying code á la Wim Gielis
Hi Wim,
in order to avoid defining a dimension for every TI_Process , I have implemented a single dimension ,
which elements are as follows: PGMnn.Elemnn.Valuenn and some attributes.
And my former Request deals with : Valuenn.
bskalli
in order to avoid defining a dimension for every TI_Process , I have implemented a single dimension ,
which elements are as follows: PGMnn.Elemnn.Valuenn and some attributes.
And my former Request deals with : Valuenn.
bskalli