I’m struggling with building a conditional relation between two tables, where I can’t seem to find a good link between the two. Coding my solution seems easy, but using glide, it feels like I’m limited.
Here’s my scenario:
I have two tables, one is called projects, the other is called waiting list.
The projects table contains a set of projects admins can build. Each project has lots of data and a “sell price”.
The waiting list is a list of people that want to buy a project. These people aren’t users in the app, just a random list of names. One column in this list is “volume”, which specifies what the minimum price they’re willing to pay for a project is.
What I want to do is build a screen on the projects page which suggests which people on the waiting list could be interested in each project.
Or alternatively: On the waiting list screen I’d like to display all projects that could be interesting per waiting list position.
Now I’ve been trying to build a conditional relation between the two tables, where I’m basically trying to find project matches where “volume” is greater of equal to “sell price”. However I couldn’t find any way to do that. I was only able to set up lookups, but I can’t use any if/else statements with that data. And for building relations I need user data, which isn’t relevant in this case.
let people = p2.split("||");
let volume = p3.split("||");
volume = volume.map(function(v){ return parseFloat(v.replace(/,/g,'')) });
let interestedPeople = [];
for (let i = 0; i < people.length; i++) {
if (volume[i] >= p1) {
interestedPeople.push(people[i]);
}
}
return(interestedPeople.join(", "));
Double check
The Regency with a selling price of 900k would attract interest from John Smith (1000k), Michael Brown (900k), Robert Taylor (1500k), Maria Garcia (900k), Karen Davis (950k).
The Garden with a selling price of 1250k would only attract interest from Robert Taylor (1500k).
Transform JSON
This filters values from Json by JQ rules
JQ there is:
map - invoke filter foo for each input
select(value) input unchanged if value returns true
Thank you! This works like a charm. The only thing I couldn’t figure out now is how I can use the data to display it in a table, rather than just displaying a comma separated list.
I’ve been using Split Text, which does the job on the table side, however I can’t select Split Text columns on the UI. Any ideas?
Thanks a ton for showing this alternative! I went with @ThinhDinh’s solution, however I’ve tried yours as well. I couldn’t figure out step 4 though. Can you elaborate on that one for future readers with a similar problem?
You need help table:
First you need go to details screen, set column current coma separated list to user row (TMP column)
Help table must contain several numbered rows
And template column which retrieve user column-> TMP column(with coma list) to each rows
Then split text the template column
Then single value by row number from spitted template
Now you can set inline list with the source from this Single value column
So, you will transposes text coma separated list to help table single value column
The split text returns an array and is mostly unusable for displaying purposes, except the kanban layout in Pages, where you can use it in the “Tags” field, I believe.
Just curious, what do you expect to see when you want to display an “array”?
I’m not following this thread very closely, but when you have an array from a split text column, you can then create relation using that array, and link it to the appropriate table. That relation can be used as the source of a list.
Thanks to Jeff!
It is a good idea that don’t use helper table to transpone array to row but use relation!
But relation must be from array to target! Exelent!