TM1 rules problem-DB and ATTRS
-
- Posts: 128
- Joined: Thu Dec 15, 2011 8:22 pm
- OLAP Product: TM1
- Version: 9.4
- Excel Version: 2003
TM1 rules problem-DB and ATTRS
I have written the rules like []=n: if(A is true,xxxx,DB('B',!e,attrs('f',!f,fname),!g))..the first condition is running fine. in the second condition attrs function is not working fine....because when i hardcode the value inplace of ATTRS then the rule is working fine..........
any reason why it is not working fine?
any reason why it is not working fine?
-
- MVP
- Posts: 1831
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: TM1 rules problem-DB and ATTRS
Attrs functions within rules are very common place and should work perfectly well. It is most likely just an issue with syntax etc.
Could you please provide your full code (exactly as it is in the rule sheet) and screenshots (or details) of the }elementattributes cube and the cube/s on which the rule is defined for (and pulling from if a different cube.)
Could you please provide your full code (exactly as it is in the rule sheet) and screenshots (or details) of the }elementattributes cube and the cube/s on which the rule is defined for (and pulling from if a different cube.)
Declan Rodger
-
- MVP
- Posts: 3241
- 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: TM1 rules problem-DB and ATTRS
A wild guess...does the Attrs pulls an alias value? Note that, if you don't populate the alias value in the }ElementAttributes cube, you will get 0.
For example, the dialog for "Edit element attributes" could be showing an alias value that is equal to the element name.
Even in that case, the }ElementAttributes cube necessarily is filled in.
If the above does not hold for you, please provide more details. This is not the first time that helpers ask you to follow the forum guidelines.
For example, the dialog for "Edit element attributes" could be showing an alias value that is equal to the element name.
Even in that case, the }ElementAttributes cube necessarily is filled in.
If the above does not hold for you, please provide more details. This is not the first time that helpers ask you to follow the forum guidelines.
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
-
- Posts: 128
- Joined: Thu Dec 15, 2011 8:22 pm
- OLAP Product: TM1
- Version: 9.4
- Excel Version: 2003
Re: TM1 rules problem-DB and ATTRS
the code is below...please refer..
[]=if(attrs('version',!version,'next')@='NA','if(DB('PB_REL',!MS_Measures,'PBV_ind')@='1'%(scan(','|attrs('sub_product',!subproduct,'PODE')|',',DB('Pbv_rel',!MS_Measures,'PBV_IND'))>0),STET,0),DB('Market size input Mster'!version,!subproduct,!Organisational Hierarchy,!MS_Geo_level,!MS_Measures);
the second part is not running first condition is running fine.
the organisational hierarchy is not present in 'market size input Mster' cube but present in current cube refered by [];
[]=if(attrs('version',!version,'next')@='NA','if(DB('PB_REL',!MS_Measures,'PBV_ind')@='1'%(scan(','|attrs('sub_product',!subproduct,'PODE')|',',DB('Pbv_rel',!MS_Measures,'PBV_IND'))>0),STET,0),DB('Market size input Mster'!version,!subproduct,!Organisational Hierarchy,!MS_Geo_level,!MS_Measures);
the second part is not running first condition is running fine.
the organisational hierarchy is not present in 'market size input Mster' cube but present in current cube refered by [];
-
- MVP
- Posts: 1831
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: TM1 rules problem-DB and ATTRS
Code: Select all
[]=if(attrs('version',!version,'next')@='NA', 'if(DB('PB_REL',!MS_Measures,'PBV_ind')@='1'%(scan(','|attrs('sub_product',!subproduct,'PODE')|',',DB('Pbv_rel',!MS_Measures,'PBV_IND'))>0),STET,0),DB('Market size input Mster'!version,!subproduct,!Organisational Hierarchy,!MS_Geo_level,!MS_Measures);
I added the space into your code so that you can see you have put a ' before your second if statement... having that there means that the second IF statment instead just becomes a string value as far as TM1 is concerned.
Edit -
Also the
Code: Select all
DB('Market size input Mster'!version,!subproduct,!Organisational Hierarchy,!MS_Geo_level,!MS_Measures)
Code: Select all
DB('Market size input Mster', !version,!subproduct,!Organisational Hierarchy,!MS_Geo_level,!MS_Measures)
Are you sure this is your actual code exactly as you've saved in the rule sheet?
P.S And please provide detail of the relevant cube and element structure.
Declan Rodger
-
- Posts: 128
- Joined: Thu Dec 15, 2011 8:22 pm
- OLAP Product: TM1
- Version: 9.4
- Excel Version: 2003
Re: TM1 rules problem-DB and ATTRS
that ' is not there by mistake I have put..... and also in attrs I ahve not used alias.and that part is running fine only from DB(Market size input mster...........) it is not running
and also , is there after 'market sizing input' cube name.... that syntax error is correct.
and also , is there after 'market sizing input' cube name.... that syntax error is correct.
-
- Posts: 128
- Joined: Thu Dec 15, 2011 8:22 pm
- OLAP Product: TM1
- Version: 9.4
- Excel Version: 2003
Re: TM1 rules problem-DB and ATTRS
the issue is solved......................thank you very much all of you for your help...........
only fault is on the left hand side I have to use ['organisational hierarchy element'] b/c organisational hierarchy is not present in market sizing mastr cube
only fault is on the left hand side I have to use ['organisational hierarchy element'] b/c organisational hierarchy is not present in market sizing mastr cube
-
- 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: TM1 rules problem-DB and ATTRS
Dilip. The problems that Declan has kindly pointed out mean that in TM1 the code you posted will not compile.
There is also another problem. There should be 2 ) characters before the final ;, one to close the DB and one to close the outer IF.
If the rule can be saved in Architect without error then you should cut and paste the rule text exactly as it appears, or attach the RUX file.
There is also another problem. There should be 2 ) characters before the final ;, one to close the DB and one to close the outer IF.
If the rule can be saved in Architect without error then you should cut and paste the rule text exactly as it appears, or attach the RUX file.
-
- MVP
- Posts: 1831
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: TM1 rules problem-DB and ATTRS
Thank god someone else said this... I thought I was going barmy!Duncan P wrote:Dilip. The problems that Declan has kindly pointed out mean that in TM1 the code you posted will not compile.
There is also another problem. There should be 2 ) characters before the final ;, one to close the DB and one to close the outer IF.
If the rule can be saved in Architect without error then you should cut and paste the rule text exactly as it appears, or attach the RUX file.
Declan Rodger