Page 1 of 1
Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 10:36 am
by mitch23
I am getting syntax error messages when attemping to use more than one ATTRS comparion in an IF statemenet in a rule, which is as follows:
['4310.10', 'TSE - Actual - Rule', 'Current Activity']=N:
IF(
DB('Control', 'Post_WOH_JE', 'Input')@='1' &
ATTRN('Job', !Job, 'UseConstructionCalcs')=1 &
ATTRS('Version_Core', 'Forecast', 'ActualsMonth')@=!Period &
ATTRS('Job', !Job, 'Entity')@=!Entity_Core,
12,0);
Some testing indicates that the issue is with using two ATTRS rather than with the actual syntax itself which works fine when I comment out one of the ATTRS lines. For example, both of the following variations of the above work fine and when I eliminate the second ATTRS:
['4310.10', 'TSE - Actual - Rule', 'Current Activity']=N:
IF(
DB('Control', 'Post_WOH_JE', 'Input')@='1' &
ATTRN('Job', !Job, 'UseConstructionCalcs')=1 &
ATTRS('Version_Core', 'Forecast', 'ActualsMonth')@=!Period,
#ATTRS('Job', !Job, 'Entity')@=!Entity_Core,
12,0);
['4310.10', 'TSE - Actual - Rule', 'Current Activity']=N:
IF(
DB('Control', 'Post_WOH_JE', 'Input')@='1' &
ATTRN('Job', !Job, 'UseConstructionCalcs')=1 &
#ATTRS('Version_Core', 'Forecast', 'ActualsMonth')@=!Period,
ATTRS('Job', !Job, 'Entity')@=!Entity_Core,
12,0);
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 10:46 am
by qml
Are you sure it's not because you didn't really get your syntax right?
['4310.10', 'TSE - Actual - Rule', 'Current Activity']=N:
IF(
DB('Control', 'Post_WOH_JE', 'Input')@='1' &
ATTRN('Job', !Job, 'UseConstructionCalcs')=1 &
ATTRS('Version_Core', 'Forecast', 'ActualsMonth')@=!Period,
ATTRS('Job', !Job, 'Entity')@=!Entity_Core,
12,0);
Replace the comma with ampersand - "&".
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 10:48 am
by Wim Gielis
Hello
I don't see anything wrong with the syntax.
Also, if the other 2 examples work, the first one should work as well.
Are you really sure / did you copy paste exactly what you have in TM1?
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 10:49 am
by Wim Gielis
Kamil,
You now have an IF containing 3 parts.
Or am I looking cross-eyed?
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 10:52 am
by qml
No, the syntax I posted is not the correct one. It is the syntax I think the OP is using (as opposed to what he claims to be using).
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 10:54 am
by Duncan P
It appears to be confused by the
& appearing after
!Period.
If you swap the tests round like this :-
Code: Select all
...
!Period @= ATTRS('Version_Core', 'Forecast', 'ActualsMonth') &
!Entity_Core @= ATTRS('Job', !Job, 'Entity'),
12,0);
it should work fine.
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 11:03 am
by qml
Duncan P wrote:It appears to be confused by the & appearing after !Period.
Erm? Any idea
why it would be confused by that syntax? I didn't think TM1 could really surprise me anymore and it seems I was wrong.
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 11:05 am
by Wim Gielis
I (only now) remember seeing cases like this in the past, but never got the gist of it.
Seems strange though, in the end it's a comparison so why not being able to reverse it?
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 11:06 am
by Duncan P
Perhaps as it is walking along the rule collecting characters for the dimensions name that is knows will follow ! it is waiting to find a dimension called "Period & ATTRS" or something of the sort.
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 11:31 am
by lotsaram
Duncan P wrote:Perhaps as it is walking along the rule collecting characters for the dimensions name that is knows will follow ! it is waiting to find a dimension called "Period & ATTRS" or something of the sort.
Can't the dimension name be encased in single quotes to resolve also? I recall this being a solution to rules not compiling when dimension names contain special characters (like operators used in TM1 rules syntax)...
e.g.
ATTRS('Version_Core', 'Forecast', 'ActualsMonth') @= !'Period' & ATTRS('Job', !Job, 'Entity') @= !Entity_Core
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 11:43 am
by Duncan P
The encasing dimension names in quotes if they have special characters works for the dimension qualifying an item name within square brackets, either side of the
= sign, e.g.
vs.
Code: Select all
['dim 2 & 3':'item1'] = ['dim 2 & 3':'item2']
However it doesn't work after a
!.
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 11:56 am
by mitch23
Duncan - thanks for the suggestion of reversing the order of comparison. I set it as follows and it works fine:
...
!Period @= ATTRS('Version_Core', 'Forecast', 'ActualsMonth') &
!Entity_Core @= ATTRS('Job', !Job, 'Entity'),
12,0);
Not sure why it would make a difference but it does.
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Tue Oct 16, 2012 3:48 pm
by Wim Gielis
mitch23 wrote:Not sure why it would make a difference but it does.
You're not alone with that

Re: Multiple ATTRS logical comparisons not allowed?
Posted: Wed Oct 17, 2012 5:54 am
by Andy Key
Pah! If I'd read this post first I wouldn't have needed to bother answering
this one!
Good to have it confirmed though. Always thought it was a bit strange.
Re: Multiple ATTRS logical comparisons not allowed?
Posted: Wed Oct 17, 2012 3:42 pm
by Steve Rowe
Is anyone able to raise this as bug with the rule compiler?
I can't as I don't have an IBM account but I'm sure someone out there does... Just because there is a workaround doesn't mean that this isn't a bug that needs fixing.
Cheers,