Rule with Picklist Question...

Post Reply
Christian
Posts: 46
Joined: Wed Nov 18, 2009 8:43 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003

Rule with Picklist Question...

Post 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.
User avatar
Michel Zijlema
Site Admin
Posts: 712
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: Rule with Picklist Question...

Post by Michel Zijlema »

Hi,

'=@' should be '@='.
You're also missing the closing ')' before the semicolon.

Michel
Christian
Posts: 46
Joined: Wed Nov 18, 2009 8:43 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003

Re: Rule with Picklist Question...

Post 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.
Christian
Posts: 46
Joined: Wed Nov 18, 2009 8:43 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003

Re: Rule with Picklist Question...

Post 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.
User avatar
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: Rule with Picklist Question...

Post 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
Technical Director
www.infocat.co.uk
Christian
Posts: 46
Joined: Wed Nov 18, 2009 8:43 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003

Re: Rule with Picklist Question...

Post 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.
Christian
Posts: 46
Joined: Wed Nov 18, 2009 8:43 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003

Re: Rule with Picklist Question...

Post by Christian »

I tried the static picklist too and it didn't work either. :(
User avatar
Michel Zijlema
Site Admin
Posts: 712
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: Rule with Picklist Question...

Post 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
Christian
Posts: 46
Joined: Wed Nov 18, 2009 8:43 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003

Re: Rule with Picklist Question...

Post 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
Christian
Posts: 46
Joined: Wed Nov 18, 2009 8:43 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003

Re: Rule with Picklist Question...

Post 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.
User avatar
Michel Zijlema
Site Admin
Posts: 712
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: Rule with Picklist Question...

Post 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
Christian
Posts: 46
Joined: Wed Nov 18, 2009 8:43 pm
OLAP Product: TM1
Version: 9.4
Excel Version: 2003

Re: Rule with Picklist Question...

Post 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.
Post Reply