Multiple ATTRS logical comparisons not allowed?
-
- Posts: 21
- Joined: Thu Jan 29, 2009 11:32 am
- OLAP Product: Planning Analytics
- Version: 10.1
- Excel Version: Office 365
Multiple ATTRS logical comparisons not allowed?
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);
['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);
- qml
- MVP
- Posts: 1096
- Joined: Mon Feb 01, 2010 1:01 pm
- OLAP Product: TM1 / Planning Analytics
- Version: 2.0.9 and all previous
- Excel Version: 2007 - 2016
- Location: London, UK, Europe
Re: Multiple ATTRS logical comparisons not allowed?
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 - "&".
['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 - "&".
Kamil Arendt
-
- 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: Multiple ATTRS logical comparisons not allowed?
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?
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?
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
-
- 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: Multiple ATTRS logical comparisons not allowed?
Kamil,
You now have an IF containing 3 parts.
Or am I looking cross-eyed?
You now have an IF containing 3 parts.
Or am I looking cross-eyed?
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
- qml
- MVP
- Posts: 1096
- Joined: Mon Feb 01, 2010 1:01 pm
- OLAP Product: TM1 / Planning Analytics
- Version: 2.0.9 and all previous
- Excel Version: 2007 - 2016
- Location: London, UK, Europe
Re: Multiple ATTRS logical comparisons not allowed?
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).
Kamil Arendt
-
- MVP
- Posts: 600
- Joined: Wed Aug 17, 2011 1:19 pm
- OLAP Product: TM1
- Version: 9.5.2 10.1 10.2
- Excel Version: 2003 2007
- Location: York, UK
Re: Multiple ATTRS logical comparisons not allowed?
It appears to be confused by the & appearing after !Period.
If you swap the tests round like this :-
it should work fine.
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);
- qml
- MVP
- Posts: 1096
- Joined: Mon Feb 01, 2010 1:01 pm
- OLAP Product: TM1 / Planning Analytics
- Version: 2.0.9 and all previous
- Excel Version: 2007 - 2016
- Location: London, UK, Europe
Re: Multiple ATTRS logical comparisons not allowed?
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.Duncan P wrote:It appears to be confused by the & appearing after !Period.
Kamil Arendt
-
- 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: Multiple ATTRS logical comparisons not allowed?
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?
Seems strange though, in the end it's a comparison so why not being able to reverse it?
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
-
- MVP
- Posts: 600
- Joined: Wed Aug 17, 2011 1:19 pm
- OLAP Product: TM1
- Version: 9.5.2 10.1 10.2
- Excel Version: 2003 2007
- Location: York, UK
Re: Multiple ATTRS logical comparisons not allowed?
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.
-
- MVP
- Posts: 3702
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: Multiple ATTRS logical comparisons not allowed?
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)...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.
e.g.
ATTRS('Version_Core', 'Forecast', 'ActualsMonth') @= !'Period' & ATTRS('Job', !Job, 'Entity') @= !Entity_Core
-
- MVP
- Posts: 600
- Joined: Wed Aug 17, 2011 1:19 pm
- OLAP Product: TM1
- Version: 9.5.2 10.1 10.2
- Excel Version: 2003 2007
- Location: York, UK
Re: Multiple ATTRS logical comparisons not allowed?
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.
However it doesn't work after a !.
Code: Select all
[dim1:'item1'] = [dim1:'item2']
Code: Select all
['dim 2 & 3':'item1'] = ['dim 2 & 3':'item2']
-
- Posts: 21
- Joined: Thu Jan 29, 2009 11:32 am
- OLAP Product: Planning Analytics
- Version: 10.1
- Excel Version: Office 365
Re: Multiple ATTRS logical comparisons not allowed?
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.
...
!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.
-
- 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: Multiple ATTRS logical comparisons not allowed?
You're not alone with thatmitch23 wrote:Not sure why it would make a difference but it does.

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
-
- MVP
- Posts: 352
- Joined: Wed May 14, 2008 1:37 pm
- OLAP Product: TM1
- Version: 2.5 to PA
- Excel Version: Lots
- Location: Sydney
- Contact:
Re: Multiple ATTRS logical comparisons not allowed?
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.
Good to have it confirmed though. Always thought it was a bit strange.
Andy Key
- Steve Rowe
- Site Admin
- Posts: 2456
- 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: Multiple ATTRS logical comparisons not allowed?
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,
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,
Technical Director
www.infocat.co.uk
www.infocat.co.uk