My first table is the user table with the gender , level and counties informations ( the user can play in different county)
My seconde table, is the Game table, with the gender (man only, women only), the level expected and the adresse of the game ( housenumber, street, post code, city and county)
On Match table, i would like to have a column with all the users who match with the game.
I created a template in each tables with Gender,Level,County and made a relation between the two tables.
It’s work when the user have selected juste one county but if the user has selectionned more than 1 county the relation doesn’t work.
Exemple :
User A : Gender = Male, Level = Medium, County = Seine-Saint-Denis, Val d’oise
Game 1 : Gender Game = Male Only, level expected = Medium, County = Val d’oise
The User A matchs with the Game 1 but I don’t know how to do it in my data editor.
A game has multiple Users
A User can match with mutiple game
Then, i would like to have this relation columne with the id user in order to have the email adress .
Yes, I show to the user the matching games by using the filter data ( i dont know if it’s the best option) :
User gender is included in Game User
and
User level is Game User
and
County’s match is included in Counties’ User
I would like to have a column with all the email’s user, which match with a game.
Like this i will be able to send an email to this people in order to warning them, there is a game which matches with their preferences .
One problem I can see right away, is that you will have issues finding a match because you use Row Owners in your user table. When Row Owners is applied, only the rows that a user owns are downloaded to their device, so they will never be able to see or access another user’s row. If this is vital to matching user up, then this won’t work.
This largely would be pretty easy by creating a template column in each table that joins Gender, Level, and County…and then create a multiple relation linking the Games table to the User table using those templates, but the fact that a user can use multiple counties, and a Game can have multiple genders does make this more complicated.
I would need to think about this more, but I think you would have to first create arrays for your County column in the User table and the Gender column in the Games table. You can do that with a Split Text column. Then you would have to create 3 separate multiple relations to link each the gender, level and county to the user table (making sure to use the split text column instead of the comma delimited column). Then you would need three lookup columns that return the User ID from each relation. Then I think you would need to use a variety of glide plugins or javascript to find the User ID’s that exist in all three relations. Ultimately you would want to end up with an array of User ID’s that match all three criteria. Then you can use that to create a multiple relation to the user table and get a list of matching users.
Yeah, that is the same way I have done with complex filters in my recent apps.
I usually have a working table (which in this case is @Thel93210 's user profiles row), then create as many relations as I need for all the fields I want to have as a filter.
Return all rowIDs that match, then find the ones that exist in all “joined list” of rowIDs returned from relations, using JavaScript.
Based on previous advice from Jeff & Thinh, I think your next steps should be:
Firstly, create 3 Joined List columns. Each of these should use one of the relations that you have created, targeting the RowID/UserID. Each will give you a comma separated list of UserIDs.
Now, create a JavaScript column, and use the following code:
var arr1 = p1.split(", ");
var arr2 = p2.split(", ");
var arr3 = p3.split(", ");
var data = [arr1, arr2, arr3];
var result = data.reduce((a, b) => a.filter(c => b.includes(c)));
return result.join(",");
In the JavaScript column, you use 3 replacements: p1, p2, p3. Each of those will be replaced with one of your Joined List columns. The JavaScript column will return a comma separated list of UserIDs representing those UserIDs that exist in all 3 lists.
To relate this back to your Users table, you would need to create a Split Text column that uses the JavaScript column as its source, and then you can use the Split Text column to create a relation with your users table.