Having key value pairs for when using "Link to dataset field" in dropsown controls

I want to use restaurant_name in the dropdown list, but have a mapped value that is unique… restaurant_id that I can inject in my SQL query. Is this possible? Restaurant name may not be unique in my data hence I want to stop using it to filter through, but I don’t want to show the id to the user for obvious reasons.

Example:

restaurant_id, restaurant_name
1, Pizza Hut
2, Pizza Hut

User should see a dropdown with two “Pizza Hut”, but when I run my query I’m using the restaurant_id field.

@yehia HI
I would like to understand your problem more. If user select Pizza Hut, which query should fire?

where restaurant_id = 1 or restaurant_id = 2 or restaurant_id in (1,2)

1 Like

One of restaurant_id = 1 or restaurant_id = 2 depending on the one they press in the dropdown (which will have two ‘Pizza Hut’ options). I know this is still ambiguous for the user, but it will be rare so it’s fine.

Hello @yehia, I would say something like this might be possible with the new filtering features that were rolled out in the last few weeks. In this situation, I would not link the control dropdown to a parameter because it will return any data where the name for Pizza Hut matches and has no way to determine a specific restaurant id since it is just a string value.

Now, if you add a filter for restaurant name to the sheet and allow the user to select one of the options, it may return Pizza Hut twice and actually link to the proper row value. I am not certain, but it seems like the best way you could accomplish this. Otherwise, you may need to do something where you link the restaurant id to the restaurant name to get your desired output. Let me know if you have any follow-up questions!

1 Like