Page 1 of 1
Rule with Picklist Question...
Posted: Mon Dec 07, 2009 4:18 pm
by Christian
Hi all,
I'm trying to write a conditional statement against a Picklist in TM1 9.5 and am getting a "logical expression" error that references the ATTRS statement. I think my approach to this statement is sound, but I must be missing something.
['Approved Cost' ] = N: IF (ATTRS('Capex Measures_Picklist', 'Status', 'Picklist')=@ 'Approved',
['Total Cost' ],0;
I created a text attribute called 'Picklist' for the dimension 'Capex Measures_Picklist'. It is a "dimension picklist" written against a dimension that has three elements; Approved, On Hold, Cancelled. The element to which this picklist is assigned has been designated a "string" element.
This is probably redundant and can be deciphered in my statement above, but I'm trying to say, IF under dimension "Capex Measures_Picklist", element "Status", attribute "Picklist", if the string value is 'Approved', then return Total Cost, else 0.
Any advice is greatly appreciated.
Re: Rule with Picklist Question...
Posted: Mon Dec 07, 2009 4:22 pm
by Michel Zijlema
Hi,
'=@' should be '@='.
You're also missing the closing ')' before the semicolon.
Michel
Re: Rule with Picklist Question...
Posted: Mon Dec 07, 2009 4:57 pm
by Christian
Thank you Michel!
I'm embarrassed...that was a pretty simple fix. I'm relatively new to TM1 but I'm getting there. Thanks again.
Re: Rule with Picklist Question...
Posted: Mon Dec 07, 2009 5:15 pm
by Christian
Hi Michel,
That did resolve the error message with the rule, but it is still not populating the 'Approved Cost' cell with the 'Total Cost' value.
Here is my new statement and feeder.
# Rule #2 IF Purchase Approved
['Approved Cost' ] = N: IF (ATTRS('Capex Measures_Picklist', 'Status', 'Picklist')@= 'Approved',['Total Cost' ],0);
# Feeder Rule #2
['Total Cost' ] => ['Approved Cost' ];
Thanks.
Re: Rule with Picklist Question...
Posted: Mon Dec 07, 2009 6:10 pm
by Steve Rowe
Your might be nearly there Christiannot sure....
['Approved Cost' ] = N: IF (ATTRS('Capex Measures_Picklist', 'Status', 'Picklist')@= 'Approved',['Total Cost' ],0);
You're passing a string value to all the arguements of the attribute cube which is kind of a strange thing to do normally the middle one would be a variable of the form !DimensionName.
Anyway according to what you have told us the Attribute staement will always fail (silently) as Status is not a member of the Capex Measures_Picklist dimension, or maybe I'm confused too!
Cheers
Re: Rule with Picklist Question...
Posted: Mon Dec 07, 2009 7:14 pm
by Christian
Thanks Steve.
Actually, 'Status' is an element in the "Capex Measures_Picklist" dimension. It is the element in the dimension for which the picklist attribute is assigned.
To assign the attribute, I went to the "Capex Measures_Picklist" dimension; selected "edit element attribute"; created a new text attribute "Picklist" and for element "Status", I wrote "dimension:9 CAP-STATUS". 9 CAP-STATUS is the dimension to which the picklist points and has only three string elements; Approved, On-Hold, Cancelled".
So from there, I set up the ATTRS statement using the parameters provided; dimension:Capex Measures_Picklist, Element:Status, Attribute:Picklist. That seemed logical to me.
I'm going to also try using a simple static picklist too and see if that works.
Re: Rule with Picklist Question...
Posted: Mon Dec 07, 2009 7:18 pm
by Christian
I tried the static picklist too and it didn't work either.

Re: Rule with Picklist Question...
Posted: Mon Dec 07, 2009 8:36 pm
by Michel Zijlema
Hi Christian,
I can't find any errors in the rule. Does the attribute 'Picklist' for the element 'Status' in the dimension 'Capex Measures_Picklist' indeed have the value 'Approved'? If not the 'Approved Cost' value indeed should be zero.
Michel
Re: Rule with Picklist Question...
Posted: Mon Dec 07, 2009 9:42 pm
by Christian
Michel Zijlema wrote:Hi Christian,
I can't find any errors in the rule. Does the attribute 'Picklist' for the element 'Status' in the dimension 'Capex Measures_Picklist' indeed have the value 'Approved'? If not the 'Approved Cost' value indeed should be zero.
Michel
Actually, the picklist attribute points to a dimension called "9 CAP-STATUS" (old CP naming convention). That dimension has 'Approved', 'On-Hold', and 'Cancelled', all string elements. I figured a check would be made against the elements in that dimension and if the input value in the "Status" element cell is 'Approved', it would find it's text match and provide the necessary criteria for the rule to function.
I had planned on doing a similar thing for asset type in the Depreciation cube. I would have a cell in the measures dimension for asset type, that would be a picklist. You pick the asset type and that provides the criteria for the depreciation calculation based on that type of asset's life.
I would assume that's why they have a dimension:dimension name method of creating picklists?
Thanks Michel
Re: Rule with Picklist Question...
Posted: Tue Dec 08, 2009 4:03 am
by Christian
Issue resolved.
I'll try to post the solution for everyone's benefit, but I'm about to pass out from exhaustion.
Thanks to Steve and Michel.
Re: Rule with Picklist Question...
Posted: Tue Dec 08, 2009 8:52 am
by Michel Zijlema
Hi Christian,
I haven't had time to look at 9.5 and the new functionality like picklists included, but (as you already found out) I don't think you can use the picklist attribute in the way you tried. I assume the picklist is a reserved attribute (a bit like the format attribute) which will get the name of a dimension (dimname_picklist, which contains the valid entry values as an element) as a value - this dimension name is the value of the 'picklist' attribute, not the elements in the picklist dimension.
Michel
Re: Rule with Picklist Question...
Posted: Tue Dec 08, 2009 10:43 pm
by Christian
Michel Zijlema wrote:Hi Christian,
I haven't had time to look at 9.5 and the new functionality like picklists included, but (as you already found out) I don't think you can use the picklist attribute in the way you tried. I assume the picklist is a reserved attribute (a bit like the format attribute) which will get the name of a dimension (dimname_picklist, which contains the valid entry values as an element) as a value - this dimension name is the value of the 'picklist' attribute, not the elements in the picklist dimension.
Michel
Michel...you are right. I was returning the name of the dimension in the picklist for that element. I wrote a DB fx that I'll share later that worked IN the cube. Now, I was trying to use the picklist like an embedded dlist in Analyst (instead of needing a full dimension in this source cube) and then mapping the items in the picklist to a full dimension with those elements present in another cube. You would do an "accumulation d-link" in Analyst. I've not found a way to make this work in the same manner in TM1...yet.