Prompt with dropdown list with key and value from a query?

Hi All,

Is there a way to add a node which displays a dropdown list with a key and value populated from a query?

Use case is to select a key, using a descriptive value, which is then propogated as a variable for use in downstream query nodes.

Many thanks,

Mirri

1 Like

Hello @Mirri,

is Value Selection Widget close to what you are looking for? If not can you explain it a bit more?

Br,
Ivan

1 Like

Hi ipazin,

This almost does what i am looking for.

Imagine I have a lookup table for fruit:

ID, FRUIT
1,Apple
2,Banana
3, Orange

And then i have a Customer Order table that looks like:

CUSTOMER_ID,FRUIT_ID,QUANTITY
1001,2,10

Looking at the above, we see that the customer with ID 1001 ordered 10 bananas.

I want to present a dropdown list with the information from the fruit lookup table.

The values you get to choose from are the text values (“Apple”, “Banana”, “Orange”), but the value I want to pass along as a variable is the associated ID (2 if I pick “Banana” from the dropdown, 1 if I pick “Apple” from the dropdown and so on).

The Value Selection Widget seems to only let me pass the actual description value, not the value from the associated ID column.

Many thanks,

Mirri

Hello @Mirri,

I see. Then you can try following approach. Use Nominal Row Filter Widget node followed by Table Row to Variable node and you’ll have both ID and description value as flow variables. In case you use above mentioned Value Selection Widget node you’ll have to add logic to map description back to ID. For that you can use Rule Engine Variable node or if there is many mappings Rule Engine Variable (Dictionary) is more appropriate.

Br,
Ivan

1 Like

Thank you ipazin, the Nominal Row Filter Widget node appears to work in my scenario.

Many thanks again!

Mirri

1 Like

Glad to hear that Mirri :slight_smile:
Ivan

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.