I am needing help to filter out a list based off user reference. I have a Group list where multiple people can join, but I want the Group list to only display if the Logged in user is in the Group. Right now, I am not able to filter it out and it shows all the Groups.
reference auth.id in your Xano query, that is the equivalent to Logged in User.
Not quite, there is no need to pass it from Adalo, because it is already included in each header to Xano and authenticated.
You can reference it from Xano… auth.id
You may need to use it in different ways depending on how your ‘group list’ data structure is.
Where would I find that?
Anywhere in Xano that you are entering a conditional: queries, pre conditions, IF statements etc…
This post was flagged by the community and is temporarily hidden.
Alright, I tried it, but is not filtering data. I have the user added to the record relation and it is still showing other records
Hi @Jonas.Underwood ,
It depends on how your data is structured in XANO, there are many ways of doing this. But if you have a simple table like:
- GroupList name/id
If you want to display the group List itself (A single record) with all the users there only if the logged in user is there you will need to call the group_list with id, you can use the “WHERE” condition in XANO with a “INCLUDE” condition
Basically, retrieve the list or lists where the user is included. Of course, it this is just a “static” id list, you can add the id of the list to filter individual results.
How do I get to that particular part? I am pretty new to Xano and I am trying my best to learn it
How does your image say group_list.User? I currently have an integer.
It’s fine, it’s just a field I created for testing, it’s not a real user field. It’s ok to use integer as long as input and comparable fields are both integers. Usually text to integer and integer to text also works, but prefer “Best practices”.
But I see something different in your screenshot, is your “All members” fields a “Object List”? It seems so from the object.
@JL_LJ What about this warning?
I guess it is an object list
How is the object list structured? We can try to parse and compare the values!
I want to clarify what I am saying, that way I don’t want to confuse you too much. I will also provide screenshots that way, it’s a bit easier.
So, I have a table called “Family Groups”. I have added table references to the Users table as a list and object type. (Screenshot below)
Now, there are users inside the reference cell with two users for one Family Group and 1 user in the other Family Group. (Screenshot below)
In Adalo, before Xano was integrated into Adalo, we were able to filter out data based on user reference. Meaning, that if a User was in a List, it would show it in the list. If a User was not on the List, that Data will not show.
That is the same concept I want to achieve, but I am not able to learn how to filter data based on user reference. I will post another screenshot below for the app and I only want one Family Group showing, but is showing all Family Groups. (Screenshot Below)
I am logged in as one of the users and I only want to see the Henderson Family since the Loggedin User is referenced to it, not the Malcom Family.
On your Get All endpoint for Family Groups you need a condition as JL and myself have said. But concentrate on the auth.id…
Family_Groups.AllMembers contains auth.id
I would not advise on relying on the user_id which is passed from Adalo as an input to Xano, this can be changed at the browser level to access other families. If you use auth.id as the filter then you are making sure this can’t happen.