Filter Query result data in Dropdown mapped data source

  • Goal:
    I try to filter a result data object which i got from a retool database query for a specific attribute. The list contains all the dropdown options and are associated with a dropdown id. So i would like to use that data object and only show options which are associated to dropdown id 1 and so on.

  • Steps:
    I tried to .filter and .filterBy through JavaScript in the mapped data source field but both seems to be not available in this setting.
    I tried wo write a transformer which splits it as a plain table to a nested json object.

  • Details:

  • Normal Query to retrieve data from retool database

  • Select module as dropdown

Any ideas how to succesfully filter data in an select module setting?

I just identified that i am able to filter on the second layer of the data object:
{{ getOptions.data.id.filter((el) => el === 1 )}}

My Problem there is i will loose all the other information which are available in the data object besides the id

image

data is an object of arrays while filter works on arrays. You'll want to transform your query like so before filtering:

return formatDataAsArray(data)
1 Like

1000x thank you