Filtering a list with Xano database

I am sorry if the question is pretty basic but I am just starting to use Xano. I already have a table in Xano with a list of posts. Each post has a “tags” field which has been created to filter these posts by the user. I know that in Xano I can go to the API and configure it introducing one input and then a conditional in the filtering option. I did it like this:

My question is how do I connect a dataSlot in React Studio with that input field? I have already connected React Studio with my Xano database but I don’t get how to make the connection to filter the list.

Thanks.

1 Like

Hi, you’d need to inject the data slot value into the API call url of the Data sheet. I’d suggest you to check out e.g. this demo project: https://www.youtube.com/watch?v=K_0WUcVjJow

Read the description and download the project file and use the snippet to create the backend. This demo explains a lot of the basic questions.

Thank you as always @Antti_Neonto. I will do as suggested. I have noticed while working that using Xano database the response is not as fast as it is with Firebase. Obviously I am using the free tier for both services and as I am in Europe and in Xano the free tier is in Oregon, maybe that is the reason that it takes a few seconds to show in the UI some action (delete an entry for example) that I do to the database.

These are totally different kind of backends. Firebase is realtime and Xano is restfull. Basically it loads new data into the data sheet only if you refresh the data sheet (in interaction) or every n-seconds which is set in the Plugin settings.

1 Like

Thank you so much! That was it. I didn’t know about these differences. I didn’t change the frequency of the refresh, but added an interaction to the publish button to refresh the dataSheet at the same time that a new post is created/deleted and that made it just perfect. No need to have the realtime feature of firestore for some publications except for the moment that a post is created or deleted.

Thank you for your guidance!

1 Like

You can do it in a datasheet e.g. posts and add the dataslot to the request like:
/posts/$slot(‘ds_tags’)

1 Like

Thank you for your answer @Oliver_Burrell. I decided not to query from the database but to download the complete “posts” table and then do the query with a JS script. It seemed to me more flexible and faster once you have the data. As it is not a large table, it was the best option. If it scales too much I would have to change the way to do it but it is just fine for now.

Thanks!