Fusion Manage Forum
Welcome to Autodesk’s Fusion Manage (formerly Fusion 360 Manage) Forum. Share your knowledge, ask questions, and explore popular Fusion Manage topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using Picklists in Computed Fields

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
ForrestJudd
1013 Views, 8 Replies

Using Picklists in Computed Fields

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.

Tags (1)
8 REPLIES 8
Message 2 of 9
ForrestJudd
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
Message 3 of 9
broepke
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, Analytics & Insights
Message 4 of 9
ForrestJudd
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.

Message 5 of 9
broepke
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, Analytics & Insights
Message 6 of 9
Tony.Gonzalez
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.
Message 7 of 9

I am also experiencing the same. Still no possibilities, I guess?


Toon Broothaerts

If my answer solved your question, please mark it as 'solution'. Else, feel free to contact me!
Message 8 of 9

You can perhaps use a script to calculate the field you are currently using a formula for. 

 

But if you have a computed field that involves  CURRENT_TIMESTAMP, or similar, that would not work.

 

In that case, perhaps use an on-edit script to copy the selected picklist value to an admin field, and then use that admin field in your formula instead? Your source field could then be anything, eg multi-select.

 

BTW I believe the index values of a picklist are based on the order in which a value is used in an item.

So if you define a RAG picklist, if your first item to use this uses Amber, then Amber will become "1". The next value to be chosen and saved will become "2".

So take care reverse engineering a formula to use the index of the picklist, because it

  1. may not be indexed as you would expect
  2. may be different on a sandbox
  3. for a new picklist, with so-far-unused values, the index values will not yet be known.
Message 9 of 9

Hi Philip,



Yes I scooped around a little bit already. Seems that that is the way to proceed. Although, from a UX perspective, it's much nicer if you could see the Computed Field changing instantly, that's what I wanted to achieve.



Thank you for your answer!





Toon Broothaerts

If my answer solved your question, please mark it as 'solution'. Else, feel free to contact me!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report