Support Topics Documentation Slack YouTube Blog

Best way to check if current user in relation data

im retrieving multiple data from one table and that table have a relation to the users table.
is there a way to check if the current user in the relation for all the retrieved data?

		"___jsonclass": "datatable",
		"view_count": 0,
		"user_in": true      <======= like this if the user in the relation
		"___jsonclass": "datatable",
		"view_count": 52,
		"user_in": false <======= like this if the user not in the relation

Hi @mohammad_altoiher

If you want to check that datatable entity contains the current user you can do it on the client side. Just retrieve user relations objects and compare them to your current user by objectId.
If you want to retrieve only datatable entities that contains the current user, you can make a call with the following whereClause:
currentUser.objectId + " IN datatable.users"

Please also visit the documentation.

Best Regards,

but if im retrieving 20 data objects and for each data object i have over 300 user relation. this doesn’t work on codeless since you cant control how many related data object you retrieve.


You can separately retrieve the data objects that contain the current user and the objects that don’t contain it.

With Regards,