How to use the Adalo Query Parameter capabilities to call a Xano API and have a filtered list of data returned?

I think Adalo has a problem with handling arrays in the output.

it works when I write the number 1

I watched how he set it up

but I didn’t see how he set it up in the external collection

Hi @AndreasAyoCruz ,
Xano works outside of the box with filters, you are missing a step here. When building your External collection, you will need to get all results without applying a filter from the beginning as you are doing currently.

To enable that, you need to go back into XANO setup and click the “QUERY…”:

Then on the “Filter”, you need to go into the “By custom query”

image

And in the configuration Enable “IGNORE EMPTY VALUES”, this will enable to build the External collections with XANO in ADALO, without having to apply a filter from the beginning, you will see if you do a Run & Debug that even without adding a value to the filter, it will return in this case all results:

Then you can just apply regular filters:

EDIT: I just watched his video, and I would assume his connection works without the “IGNORE EMPTY VALUES” because he uses an “includes” in the custom query as opposed to me using an “Equal”, in my case it is mandatory a value, while in “includes” probably not. need to test.

Is your filter “includes” and it still does not work?

My 2nd guess is, first theory fails (includes is giving you error), that in the video he had the “ignore empty values” on when creating the collection, and then he turned it off after, to ensure that the GET request couldn’t be bypassed without having a filter value as mandatory. Just tested this and works pretty fine, so a neat hack to enable the XANO list and get the filter mandatory for more security :slight_smile: .

2 Likes

@JL_LJ omg thank you so much for this. I have been looking everywhere (Xano and Adalo documentation) for how to properly do filtering in external collections and finally understand it now that I read this thread. Seriously, thank you.

@xano and Adalo product team - I think this should be easy to document and add to your knowledge-base since I couldn’t find anything like this. Setting up the databases beyond showing a GET ALL is pretty crucial since filtering is a minimum req’t for almost all apps.

1 Like

There seems to be an issue when using filters from an external database with Xano for me. When I test it in the browser preview tool, the list contains all records for a split second before then showing only the filtered records. Is this an issue with the preview tool or is this how Adalo handles these filters? (Displaying all records within a database for 0.2 second, then filtering it 0.2 seconds later)

Make sure in Xano that if you don’t give an input, to let your API returns all the results, Adalo can only save an external endpoint, only if it returns results

Hi @pablob8 ,
I would suspect this would be a client/server side issue with Adalo, Server side pulling everyhing as the external collection is built with a get all, and then client side does the filtering, thus a very small delay. But would be great if the Adalo team would confirm this.

If you don’t want all results to be displayed and the results are always based on a filter in xano/adalo, what you could try to do is, in xano enable the filter field that you use as “required”, then maybe the server side does not pull anything until the filter is actually applied. Never tested this, just popped up in my mind. But need more details on how your setup is currently done and the outcome desired.

@JL_LJ I thought the same thing – that it was the client performing the filter only after receiving the GET ALL call on all the data before the filter was applied. But now I am attempting to replicate the bug (if it even is a ‘bug’) and haven’t been able to do it as I filter other lists with other API endpoints. I was messing with some of these CRUD endpoints prior to implement the ext collection db in Adalo. If I spot it again, I will try to see if your approach of forcing the field to be required to force the server to only send over user data to the front end.