Skip to main content
1-Visitor
Jan 27, 2015 8:42 PM UTC
Solved

An easy scripting question...

Is there an API, or easy method, to get the numeric value associated with the string value of a Pick Field?

    21-Topaz I
    Jan 27, 2015 9:37 PM UTC

    Hi Sean,

    Have you looked at the imFieldBean? It has a method that sounds like it will do what you want:

    getPickFieldMappings()

    If getFieldType() is the value "pick", then this method will return a mapping of the display strings to the underlying numeric pick values.

    4 replies

    1-Visitor
    Jan 27, 2015 9:13 PM UTC

    Wouldn't using the im command work?

    im fields --hostname=<your-host> --fields=type,picks,name

    You could redirect it to a log file and extract the values from the pick types.

    Translate
    1-Visitor
    Jan 27, 2015 9:17 PM UTC

    That would be harder than what I'm doing at the moment; which is hard-coded string lookup tables. I was hoping that there was an easy API call to use instead of getFieldValue.

    I'm in a trigger script and need the numbers to perform calculations. So dumping the values to a log file really isn't a practical option.

    Thank you for the idea, though.

    Translate
    21-Topaz I
    Jan 27, 2015 9:37 PM UTC

    Hi Sean,

    Have you looked at the imFieldBean? It has a method that sounds like it will do what you want:

    getPickFieldMappings()

    If getFieldType() is the value "pick", then this method will return a mapping of the display strings to the underlying numeric pick values.

    Translate
    1-Visitor
    Jan 27, 2015 11:38 PM UTC

    Thank you, Joe. That will do it.

    Translate