PLM 360 General Discussion

PLM 360 General Discussion

Reply
Active Contributor
ForrestJudd
Posts: 38
Registered: ‎04-28-2008
Message 1 of 6 (299 Views)
Accepted Solution

Using Picklists in Computed Fields

299 Views, 5 Replies
10-12-2012 02:56 PM

I've a question about comparing against picklist fields in computed fields.

 

The TLDR version: It appears I can get the *index* of a picklist field (that uses a user defined picklist) for use in a computed field. Can I get the picklist field's *value* instead?

 

Here's the context:

 

In the default tenant workspaces there are several instances where a field's background color is changed depending on other fields. This is done using a CASE statement, like so:

 

(CASE

 

       WHEN (NEXT is null) THEN

 

                [do something here]

 

What if we want to evaluate multiple conditions as part of the CASE statement? That's pretty straightforward, we can just add in an AND keyword and the additional condition, like so:

 

(CASE

 

      WHEN (NEXT is null AND [additional condition]) THEN

 

           [do something here]

 

But what if the condition statement wants to check against the value of a picklist? What we finally puzzled out is that the 'value' of a picklist field actually reports as an integer value. This value appears to indicate the index of the selected value.

 

The index appears to be granted in the order the value was added to the picklist, not the currently sorted order. What we were specifically working on is the suppliers workspace, which has a field called CYCLE_MONTHS. The first value in the list, '00' is index 5. The second value, '12' is index 3. This was consistent in two different tenants.  The default picklist has 10 total values. When I added an 11th value, its index became 11.

 

I'm confident I can use this for computed fields, but.... what if the picklist changes? Adding values would be no problem. But what about when values are removed? After a bit more testing, it appears that the indexes *do not* change - at least not immediately.  As an example, I removed the value 18 (with index 1) from the cycle_months picklist. It *did not* change the index of value '00' (index 5).

 

Ok, all that being said...is there a way I can directly access the *value* of the picklist with a computed field? I'd really rather check against what I expect the field will show, not its index. I'm afraid that the index might change over time, while I would expect its value to be constant.

Hi there,

 

In a computed field you can only get access to the index.  You are correct that these don't change so with a little investigation you can reverse the indexes back out to the values you need.

 

If you need something more complex you should use scripting.  It has access to the values as well as a much more elaborate set of functions that can be used.

Active Contributor
ForrestJudd
Posts: 38
Registered: ‎04-28-2008
Message 2 of 6 (295 Views)

Re: Using Picklists in Computed Fields

10-12-2012 03:10 PM in reply to: ForrestJudd

One thought I just had is if I could use a SELECT statement in the computed field to derive the actual value based on the index, but I don't know:

 

  • if SELECT is valid in a computed field
  • What columns would be used for the select statement
  • What the table name would be
Board Manager
broepke
Posts: 180
Registered: ‎01-24-2004
Message 3 of 6 (283 Views)

Re: Using Picklists in Computed Fields

10-14-2012 08:49 AM in reply to: ForrestJudd

Hi there,

 

In a computed field you can only get access to the index.  You are correct that these don't change so with a little investigation you can reverse the indexes back out to the values you need.

 

If you need something more complex you should use scripting.  It has access to the values as well as a much more elaborate set of functions that can be used.



Brian Roepke
Director of PLM & PDM
Autodesk, Inc.

Active Contributor
ForrestJudd
Posts: 38
Registered: ‎04-28-2008
Message 4 of 6 (271 Views)

Re: Using Picklists in Computed Fields

10-15-2012 08:45 AM in reply to: ForrestJudd

Thanks for the quick feedback Brian.  Is there a good reference somewhere for syntax and what we can access via computed fields?  I'm an experienced programmer, but I had to do a fair amount trial and error to get the syntax of the logic statements to work out in this case.

Board Manager
broepke
Posts: 180
Registered: ‎01-24-2004
Message 5 of 6 (265 Views)

Re: Using Picklists in Computed Fields

10-15-2012 09:20 AM in reply to: ForrestJudd

There isn't an exhaustive list of what's supported - You can basically say it's more limited in it's syntax than rich.  Meant to do simple calculations for the most part (like LENGTH * WIDTH).  But some additional things are supported.  Here is an article that someone on the team came up with that might help

 

http://wikihelp.autodesk.com/PLM_360/enu/Community/Tips/Configuring_Fields/Computed_Fields%3a_Small_...



Brian Roepke
Director of PLM & PDM
Autodesk, Inc.

Member
Tony.Gonzalez
Posts: 3
Registered: ‎09-17-2013
Message 6 of 6 (87 Views)

Re: Using Picklists in Computed Fields

04-29-2014 11:48 AM in reply to: ForrestJudd
I am experiencing the same and given the date of this post I am assuming there is no fix or workaround to this using computed fields.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.