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âŚ
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
- User_id
- User_name
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.
Hey,
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.
Hi Jonas
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.
Itâs a full Xano integration correct? So user table in Xano?
Your endpoint appears set to not require authentication. Turn authentication on, then when you ârun and debugâ it will ask for your auth token, and helpfully generate one for you when you select the user. From this boxâŚ
You should authenticate based on the xano âuserâ table. Check out the Xano tutorials on how to set that up if you need.