The selected data source is empty or could not be converted to an array

Hello @victoria

I've been trying to follow the instructions at Use Retool and Fauna to build a Todo app - Fauna Documentation).

Please take a look at the following step: "Edit the select1 form element to have the following properties".

I follow the instructions (to the best of my ability) and then I get the message:
"The selected data source is empty or could not be converted to an array".

Please help.

Now I selected the "Use Javascript" option for Data Source when mapping. The error does not occur, but the dropdrown is empty.

Hey @hyberson!

Can you try setting the select's fields as follows and let me know if that works?

"Data source": {{ }}

"Value": {{ item._id }}

"Label": {{ item.title }}

Taking a quick look at the tutorial it seems that is the array of values that you want to iterate over. Since it's nested deep in the results of your query it's hard for Retool to distinguish what exactly it should be pointing to, you should be able to pass that to the data source.

Once you've passed that array you can iterate over each item in the array with the item variable in both the "Value" and "Label" fields, which is with item._id and item.title should work there.

You can read more about mapped values here!

1 Like

Hi @Kabirdas.

It worked.

Thank you very much for your help.


For a newbie like me, it is useful to know where to search for the correct value of the "Data source" field.
Now it seems to me that the value can be "found" at
Left Panel > State tab > (resource) query name > data > body.

Would this be true, in most cases?


Yep! The left panel is a great place to inspect the structure of the data being returned by your queries. The "Data source" field typically expects an array so you'll want to expand that property in the left panel until you find one that holds all the data you want to display.