Skip to main content
1-Visitor
Nov 23, 2015 1:17 PM UTC
Solved

How to get the Value of a pick-field in a computed expression?

Hi @all,

with IM 10.7 we want to concatenate some fieldvalues into another field of the same item. For this we had created a shorttext-field with a computation. One of the fields we want to use is a pickfield, and (as stated in the documentation) pick-fields always return only the number of the selected entry and not the value. Are their any known workarounds which you can share with me? Thanks,

cheers, Jens   

    17-Peridot
    Nov 30, 2015 5:49 PM UTC

    Perhaps this workaround helps.

    Assuming there are not hundreds of pick values, you can create a simple if-then-else statement and set the to-be-returned values explicitely.

    FieldType: Short Text

    Calculation: (PickField=1?"First Pick Value":(PickField=2?"Second Pick Value":"Last Pick Value")).

    Not tried but perhaps it helps.

    For sure you need to update the values acccordingly to what you have defined in the pick field itself.

    Volker

    5 replies

    16-Pearl
    Nov 24, 2015 9:41 AM UTC

    Hi Jens,

    have you tried  "getFieldValue(item#, field)"

    <copy from function classes documentation>

    "Returns a field value in a specific item ID. For example, getFieldValue (234, “Found in Build”) returns a Found in Build field value of 7415 for Defect 234. "

    in you case it would be something like

    (RelExists("YOUR_IBPL_PICK_NAME")  )? isEmpty( getFieldValue(YOUR_IBPL_PICK_NAME, THE_IBPL_PICK_DISPLAY_FIELD),Text("-unknown-")) : emptytext()

    HTH Matthias

    Translate
    JensN.1-VisitorAuthor
    1-Visitor
    Nov 24, 2015 10:56 AM UTC

    Hi Matthias,

    unfortunately "getFieldValue(item#, field)" works for the most fieldtypes except ordinary pick-fields. A pick-field always returns the number of the selected entry, when used in a computation. Another try was to substitute the entry-number with its value inside of the computation, but it doesnt work either.

    It seems that this is working only by a trigger, but i wanted to avoid using a trigger.

    cheers, Jens

    Translate
    17-Peridot
    Nov 30, 2015 5:49 PM UTC

    Perhaps this workaround helps.

    Assuming there are not hundreds of pick values, you can create a simple if-then-else statement and set the to-be-returned values explicitely.

    FieldType: Short Text

    Calculation: (PickField=1?"First Pick Value":(PickField=2?"Second Pick Value":"Last Pick Value")).

    Not tried but perhaps it helps.

    For sure you need to update the values acccordingly to what you have defined in the pick field itself.

    Volker

    Translate
    JensN.1-VisitorAuthor
    1-Visitor
    Dec 1, 2015 6:57 AM UTC

    Hi Volker,

    thanks for your answer. I did actually try some kind of this if-then-else stantement, but maybe not deep enough. I will look into it again...

    cheers, Jens

    Translate