Get label from dialoglist

on a field I have a list of member like this :txt1|value1:txt2|value2:txt3|value3…

when we choosed a txt value the doc is saved and txt value is displayed.

but the value of the field is valueN and not txtN

How can I get the txt value?

Subject: get label from dialoglist

There is no easy way to get it. The label is only that: a label. It is not stored anywhere except in the form, while the field itself contains the real value.

You might try a FieldGetText to see if it will pull the text value through the interface, but even that wouldn’t help you if you work on the backend.

There is a solution, but it is a bit more complex and it requires you to re-work your structure:

  1. Create a form to store a label configuration, and a view to show all the label sorted by their “key” value (the real value)

  2. Create one document using this configuration form, for each possible value that your dialogbox will show. Each document contains 2 fields: one contains the value and the other the label. The value must be unique for this to work.

  3. In the formula for the dialogbox, try:

Key := @DbColumn (“”:“NoCache”; “” ; ; 1);

TextValue := @DbColumn (“”:“NoCache”; “” ; ; 2);

@If (@IsError (Key) | @IsError (TextValue) ; “” ; TextValue + " | " + Key)

Now, the dialogbox displays the text values but only key ois truly selected in the field - exactly like before.

But now, you can lookup inside your config document to get back the text value, based on the key.

  1. Create a field to hold the label text value itself, computed:

TheLabel := @DbLookup (“”:“NoCache” ; “” ; ; ; 2);

@If (@IsError(TheLabel); “” ; TheLabel)

Voila…

HTH

Nicolas Abesdris

Quintessence e-solutions Inc.

Subject: Simple solution to get label from dialoglist

Simple way to solve the problem:

  1. Create a multi valued field on the form (called values) that holds the value list.

  2. Create a combo box (or dialog list etc.) field (called lookup) that holds the value selected by the user.

  3. Create an output field (computed) that holds the output value you want. Use the following formula:

list := @Word ( Values; “|”; 2);

position := @Member ( Lookup; list );

@If ( position > 0; @Word ( values [ position ]; “|”; 1 ); “undefined” )

The above works, and should give you an idea of how to solve your problem. Note that it only works for a single value list selection, i.e. “Lookup” must be a single value.

Regards,

Chris