# Conditional relations that aren't related to the logged in user

**URL:** <https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173>\
**Category:** Ask for Help\
**Created:** [January 27, 2023, 3:52pm UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173 "2023-01-27T15:52:40Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![tzatti](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tzatti/32/52422_2.png) [@tzatti](https://community.glideapps.com/u/tzatti)\
**Post date:** [January 27, 2023, 3:52pm UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/1 "2023-01-27T15:52:40Z")

</div>

Hi community,

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.

Does anyone know how to resolve this?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 28, 2023, 12:46am UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/3 "2023-01-28T00:46:24Z")

</div>

I’ll try to set up something for you when I have time over the weekend.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 28, 2023, 1:27am UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/4 "2023-01-28T01:27:36Z")

</div>

Here’s my setup:

**Projects table** :

| Project Name | Selling Price |
| --- | --- |
| The Parkview | 1200000 |
| The Regency | 900000 |
| The Summit | 1500000 |
| The Riverside | 800000 |
| The Heights | 1300000 |
| The Estates | 1000000 |
| The Villas | 950000 |
| The Garden | 1250000 |
| The Haven | 1100000 |
| The Retreat | 1050000 |

**Waiting list table:**

| Person’s Name | Volume |
| --- | --- |
| John Smith | 100000 |
| Jane Doe | 50000 |
| Michael Brown | 75000 |
| Lisa Johnson | 80000 |
| David Wilson | 90000 |
| Robert Taylor | 60000 |
| Maria Garcia | 85000 |
| James Lee | 70000 |
| Karen Davis | 95000 |
| Ronald Martinez | 65000 |

Then I use two joined list columns to bring the list of people and their volumes to the Projects table:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/f/3f17ebdc1a0865c82dfb39ae77f29e53ea307667.jpeg)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/0/b09507c904d020a6fd758d1d791adafee63dc72e.png)

Then I use a JavaScript column to process and output the list of people that would be interested in each project.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/1/519f418dccfd26c9b86b685081d9918721da6bf3.jpeg)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/e/de9cab463d836294596284f7e3c950c7e2c9b3cf.png)

```auto
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).

---

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [January 29, 2023, 6:04pm UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/5 "2023-01-29T18:04:10Z")

</div>

Hi!  
Some no code solution:

1. In the user Value table you need to prepare Json Object using “Make Json Object”  

2. Lookup this column to Project table

3. Finish JSON and prepare template for JQ (select if User value \> Project Value)  

4. 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

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/1/21e154c25c1b34245f673acac11e3804ecbc879b.png)  
Try to use [jq play](https://jqplay.org/#) to play with

1. Clear results  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/6/06aaf919dd25ac95a8a93642e464500170d61d3d.png)

There no java script, but Glide plugin(Transform JSON) maybe slow your Pages

---

<div class="post-metadata">

**Author:** ![tzatti](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tzatti/32/52422_2.png) [@tzatti](https://community.glideapps.com/u/tzatti)\
**Post date:** [January 30, 2023, 3:31pm UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/6 "2023-01-30T15:31:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tzatti](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tzatti/32/52422_2.png) [@tzatti](https://community.glideapps.com/u/tzatti)\
**Post date:** [January 30, 2023, 3:32pm UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/7 "2023-01-30T15:32:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [January 30, 2023, 4:32pm UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/8 "2023-01-30T16:32:25Z")

</div>

> [@tzatti](#):
>
> I can’t select Split Text columns on the UI. Any ideas?

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

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 31, 2023, 12:02am UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/9 "2023-01-31T00:02:24Z")

</div>

> [@tzatti](#):
>
> 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.

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”?

---

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [February 1, 2023, 9:36am UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/10 "2023-02-01T09:36:20Z")

</div>

> [@ThinhDinh](#):
>
> Just curious, what do you expect to see when you want to display an “array”?

May be, when we see the coma list of results and can convert it to inline list inside details, in this case we can tap one of to deal next

---

<div class="post-metadata">

**Author:** ![tzatti](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tzatti/32/52422_2.png) [@tzatti](https://community.glideapps.com/u/tzatti)\
**Post date:** [February 1, 2023, 10:52am UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/11 "2023-02-01T10:52:33Z")

</div>

> May be, when we see the coma list of results and can convert it to inline list inside details, in this case we can tap one of to deal next

Yes, that’s exactly it.

---

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [February 1, 2023, 11:16am UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/12 "2023-02-01T11:16:16Z")

</div>

> [@tzatti](#):
>
> Yes, that’s exactly it.

Do you clear about solution?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [February 1, 2023, 12:43pm UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/13 "2023-02-01T12:43:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![slscustom.ru](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/slscustom.ru/32/77336_2.png) [@slscustom.ru](https://community.glideapps.com/u/slscustom.ru)\
**Post date:** [February 1, 2023, 5:50pm UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/14 "2023-02-01T17:50:08Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![tzatti](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tzatti/32/52422_2.png) [@tzatti](https://community.glideapps.com/u/tzatti)\
**Post date:** [February 2, 2023, 11:58am UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/15 "2023-02-02T11:58:55Z")

</div>

Thank you, that resolves my problem 🙂  
Thanks everyone involved!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [February 3, 2023, 11:59am UTC](https://community.glideapps.com/t/conditional-relations-that-arent-related-to-the-logged-in-user/57173/16 "2023-02-03T11:59:48Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
