Dropdown control with key|value pairs


Badge +3

Hello,

for a special form I have set up a list containing a choice field. In the form the field will be a dropdown control.

The selectable options in that field have the format "key|value".

For example:

   US|United States of America

   GB|United Kingdom

   DE|Germany

The key is the part that will be saved with the item while the value part is only for display that to the user. Further the key is used for calculation of special values. This is the reason for using key and value pairs.

Now in a workflow I find that I need to write E-mails containing the choice of the user. Now I want to ask  how I can now get the displayed value?

My first idea was to store that value to a separate colum after the user did his choice. But I have no idea how to find out that value and not the key?

Can anybody give me a hint? May be that is simple.

Thanks in advance.

regards

Martin


3 replies

Userlevel 5
Badge +12

Hello use a regular expression action within your workflow and configure as follows:

Place the following in the pattern area:

.*|

Select Replace Text as the action's radio button option.

Leave replacement text blank.

Your input text will be the variable holding the key|value pair that was selected.

Store your results in a string which will be the value that was selected:  

So if it had been: US|United States of America  your string will now hold United States of America which you can insert into your email.


Thanks

Mike

Badge +3

Hello,

thank you for your answer. I checkt that out. But unfortunally that does not work. The reason is that the column of that item contains only the key part (US in your example) of the selected option after beeing created using the form. 

In my opinion I would prefer that Nintex would store the whole option into the field. This can be reached using QuickEdit. But if you now open the item for editing, the dropdown box will not show the saved value correctly.

May be that I better have to use a listlookup for the dropdown rather than using a choice field.

Kind regards

Martin

Userlevel 5
Badge +12

Hello,

Sorry but I'm a bit confused on the way you have it setup.   I thought you mentioned that you had the values stored in a choice field in the format of Key|Value which would result in a selection of Key|Value.

I would suggest placing these values in separate columns and use a ListLookup (I would have suggested this earlier but I thought you had the design mentioned above already in place and were looking for a way to parse).

I would then Display in the List Lookup on the form either the Key or the Value in the dropdown (depending which the user is familiar with) and then use a calculated field on the form to display the other part (key or value).   This way they'd be able to view both and you would have both nicely separated and accessible for use as you please. 

Thanks

Mike

Reply