Skip to main content
Kris Hunt
Brainiac
April 4, 2018
Answered

How do you reference the export value of a combo box item?

  • April 4, 2018
  • 1 reply
  • 877 views

If the event.value of a combo box is the item name of the current selection, then what do you use to reference the current selection's export value?

This topic has been closed for replies.
Correct answer try67

Good question. There's no simple way. The most direct way would be to use the currentValueIndices property and the getItemAt method to get it, but that doesn't update until after the validation event, so if you try it you'll get the value from before the change.

The only approach that I found to work is to basically iterate over all the items in the field (using numItems and getItemAt), comparing them to event.value, and if you find a match then use getItemAt again to get the export value of that index.

1 reply

try67
try67Correct answer
Community Expert
April 4, 2018

Good question. There's no simple way. The most direct way would be to use the currentValueIndices property and the getItemAt method to get it, but that doesn't update until after the validation event, so if you try it you'll get the value from before the change.

The only approach that I found to work is to basically iterate over all the items in the field (using numItems and getItemAt), comparing them to event.value, and if you find a match then use getItemAt again to get the export value of that index.

Kris Hunt
Kris HuntAuthor
Brainiac
April 4, 2018

I guess I won't worry about it, then; referencing the item name works fine; it just seemed a little clunky. Thanks.