Attempted binding a data variable to the option list of a dropdown field gives a silly error



I am trying to bind a data variable to the option list of a dropdown field, and I get an error stating “list of object with 2 properties” is not assignable to the type “list of object with 2 properties”

I do not see how I can populate a dropdown list with variable data. Is there a formula i should be using instead?

Thanks,

MAC

Hi,

The editor is very picky about data types matching exactly, so sometimes it gives a weird warning like that. In the case of the dropdown, the data type of your option list has to have the properties label and value . So if your list of objects doesn’t have the properties label and value that are both text type, it will throw that warning.

What you can do is use a formula for binding instead, and MAP your data to match the needed format. So the formula would be something like:

MAP(data.alignment, {label: item.property1, value: item.property2})

1 Like

Is there a way to use items in a list as property1 in the MAP function? I am getting an array from cloud firestore that I would really like to be able to use in this method.

Thanks!

I think i need a functional equivalent to Array.forEach(), but I don’t know how to make that work here.

I think I can make this work. I will update later, in case anyone has similar questions. I did notice that on the appgyver firestore page it all but said “dont use arrays!”

:slight_smile:

EDIT:

Nope. I have no clue what I am doing.

Just to make it clear, in you screenshot of the data schema, what do you want as the labels and values of the dropdown? I’m sure this can be done with a MAP, just a bit more complicated one that I first suggested :slight_smile:

I would be okay with both label and value being the same and populated from the alignment array if I can. If not I added a second array called class to my schema that i can use, and have alignment be the label, and class the value until I figure out what values actually do.

Thanks for the help. I am having a lot of fun with this project and am excited at the idea that I can make this fun little app for myself!

I won! Sort of. It is enough for me to do what I wanted to do with the app for now. I do not know if I will reach a point where i need to have unique values for label and value, but i will cross that bridge when I come to it.

all I need now are support for in app purchases, ad mob, or react plugins and my app will rule the world!

Thanks for the help Cecilia

1 Like

Why you cant post it as text, but image?