How To Populate Dropdown from Data Resource

I have a data resource and I would like to populate a drop down control with the .Name and .ID fields from all the records in the resource.

How do I do that? A link to docs or video is appreciated!

2 Likes

Once you have the data from your data resource in a data variable – let’s say its name is myData, you can use the MAP formula function to transform the data.

The dropdown requires an array of objects with label and value, so your formula for the Dropdown options would look like MAP(data.myData, {label: item.Name, value: item.ID}) (the curly braces allow you to create an object directly in the formula).

7 Likes

Harri,
Thanks for tagging me on this, and it worked perfectly!!

3 Likes

Could you please ad this to the interface somehow? I had to search all over to figure out how to populate a dropdown which seems like a pretty common use case. The error message I had was baffling (something about how a list of objects with 2 properties was incompatible with a list of objects with 2 properties…hehe.)

1 Like

Hi, we have the info in the tool tip for the list (like in most other cases), but I agree that it can sometimes be quite hidden from users.

image

The problem here is that we have to balance between showing enough information and not cluttering the user interface too much since there’s already quite a lot of stuff on display.

Another way to check what a component needs as property is to use the basic static binding option and look what our binding editor suggests. That should give an indication of what you need if you want to work with Formulas. With Dropdown I mean this modal that opens when you change the binding:

This is helpful, thanks!

Hi Harri_Sarsa,

Very new to appgyver but I have successfully created a (Text Fillable) app that updates a firebase backend that I can then pull out as a CSV using Refiapp. I need this workflow so other office staff can manage selectable content in the app without having to update the app itself using CSV’s. I now need to add more complexity using cascading dropdown selections but have hit a wall with organizing my firebase data. My app is a truck hauling load tracker that my drivers will use. They need to enter/select a Project Name, Source Name, Location Name, Driver Name, Truck-Trailer ID, and Quantity Hauled. I’ve been playing with the static dropdown and can see my temporary list of Drive A, Drive B, and Driver C that I can select but when moving to firebase with an array I can’t get the MAP function you mentioned above to work with Label: Item and Value: item. Can you help me identify how to organize my firebase to correctly run a Rest API that generates the label and value I need for long lists of Names?