Page 1 of 1
TM1 rules problem-DB and ATTRS
Posted: Tue Aug 27, 2013 9:18 pm
by dilip
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?
Re: TM1 rules problem-DB and ATTRS
Posted: Tue Aug 27, 2013 9:23 pm
by declanr
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.)
Re: TM1 rules problem-DB and ATTRS
Posted: Tue Aug 27, 2013 9:43 pm
by Wim Gielis
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.
Re: TM1 rules problem-DB and ATTRS
Posted: Tue Aug 27, 2013 9:45 pm
by dilip
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 [];
Re: TM1 rules problem-DB and ATTRS
Posted: Tue Aug 27, 2013 9:52 pm
by declanr
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)
should presumably be:
Code: Select all
DB('Market size input Mster', !version,!subproduct,!Organisational Hierarchy,!MS_Geo_level,!MS_Measures)
(an extra comma inbetween the cube name and first dimension)
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.
Re: TM1 rules problem-DB and ATTRS
Posted: Tue Aug 27, 2013 9:58 pm
by dilip
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.
Re: TM1 rules problem-DB and ATTRS
Posted: Tue Aug 27, 2013 10:08 pm
by dilip
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
Re: TM1 rules problem-DB and ATTRS
Posted: Tue Aug 27, 2013 10:16 pm
by Duncan P
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.
Re: TM1 rules problem-DB and ATTRS
Posted: Tue Aug 27, 2013 10:21 pm
by declanr
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.
Thank god someone else said this... I thought I was going barmy!