Page 1 of 1
TM1 rule subst with dimension element
Posted: Thu Nov 28, 2019 9:40 am
by viocristi
Hi there,
I would need some help with the correct syntax.
I have a dimension, let's call it abc. This dimension has the following structure:
Total abc
all internal abc
total internal
1000
1100
total external
2000
2100
2000
3000
3100
What I want to achieve: in the cell security of a cube, I want to edit the existing rule to add one condition to simply ignore all elements of the dimension which start with a 2.
I tried: & subst(!abc,1,1) @<> '2'
I get: Syntax error on or before:'' !abc,1,1) @ <> '2' Invalid string expression.
How can I fix this?
Thank you
Re: TM1 rule subst with dimension element
Posted: Thu Nov 28, 2019 12:13 pm
by tomok
To get help you're going to need to provide the actual offending code instead of pseudo code.
Re: TM1 rule subst with dimension element
Posted: Thu Nov 28, 2019 12:50 pm
by viocristi
It's really the same case. The only difference is that I have another 3 letters as my dimension name. The numbers and the structure and the formula I used is the same.
I just want an example of how would one would exclude all the dimension elements which start with a certain character. I know that i can call the dimension element by using !dimName and the subst function should allow me to do a LEFT 1 on that string and then <> with the character I want to ignore.
Re: TM1 rule subst with dimension element
Posted: Thu Nov 28, 2019 12:54 pm
by tomok
viocristi wrote: ↑Thu Nov 28, 2019 12:50 pm
It's really the same case. The only difference is that I have another 3 letters as my dimension name. The numbers and the structure and the formula I used is the same.
Really? No one is going to be able to help you diagnose a syntax error without seeing the exact offending code. I guess you really don't want anyone's help.

Re: TM1 rule subst with dimension element
Posted: Thu Nov 28, 2019 12:59 pm
by viocristi
please see my edit: I would be happy with just a general example on how to filter out an element.
Something of the equivalent of an sql syntax of:
and left (abc,1) != '2'
Re: TM1 rule subst with dimension element
Posted: Thu Nov 28, 2019 2:54 pm
by tomok
viocristi wrote: ↑Thu Nov 28, 2019 12:59 pm
please see my edit: I would be happy with just a general example on how to filter out an element.
Something of the equivalent of an sql syntax of:
and left (abc,1) != '2'
SUBST(!abc,1,1) @= '2'
Re: TM1 rule subst with dimension element
Posted: Thu Nov 28, 2019 3:32 pm
by viocristi
so my syntax was ok, I can do something like that in a tm1 rule, so it must be something else. Thank you
Re: TM1 rule subst with dimension element
Posted: Mon Dec 02, 2019 1:38 pm
by MGrain
Sometimes it can help to wrap up your element reference in something else:
Subst(DIMNM('abc',DIMIX('abc',!abc)),1,1)@<>'2'
Re: TM1 rule subst with dimension element
Posted: Tue Dec 03, 2019 9:46 am
by Steve Rowe
I have seen issues with the compiler where if you mix a numeric test and a string test in the same conditional expression that it will give a false positive syntax error, it was a long time ago though.
i.e. If ( 1=2 & 'a'@='b' ,.... would fail to compile but If ( 'a'@='b' & 1=2 , ........... would
Re: TM1 rule subst with dimension element
Posted: Mon Dec 16, 2019 10:51 am
by viocristi
thank you, I solved the issue. I inserted a dimension attribute which is getting populated from the sql dwh and I just filter based on this on in the rule. And it works
