Skip to main content
1-Visitor
November 23, 2015
Solved

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

  • November 23, 2015
  • 2 replies
  • 2514 views

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   

    Best answer by VolkerEckardt

    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

    2 replies

    16-Pearl
    November 24, 2015

    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

    JensN.1-VisitorAuthor
    1-Visitor
    November 24, 2015

    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

    17-Peridot
    November 30, 2015

    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

    JensN.1-VisitorAuthor
    1-Visitor
    December 1, 2015

    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