# Look up latest value from the another table

**URL:** https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257
**Category:** Ask for Help
**Created:** [November 16, 2022, 3:04am UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257 "2022-11-16T03:04:17Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![jcmaad](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jcmaad](https://community.glideapps.com/u/jcmaad)
#### Post date: [November 16, 2022, 3:04am UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/1 "2022-11-16T03:04:17Z")

</div>

![Screenshot 2022-11-15 215836](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/7/47064a53e45e16356eb087157e559514ec440ec2.png)

I am trying to get the Open value in the Table 2 under Reservation Status column. I tried a bunch of ways but I can’t get it to work.

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [November 16, 2022, 3:11am UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/2 "2022-11-16T03:11:45Z")

</div>

- In Table 2, create a multiple relation that matches the StockID to the StockID in Table 1
- Use a Single Value → Last to fetch the Reservation Status via the relation.

_NB. The above assumes that records will always be added in chronological order._

---

<div class="post-metadata">

### Author: ![jcmaad](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jcmaad](https://community.glideapps.com/u/jcmaad)
#### Post date: [November 16, 2022, 4:25am UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/3 "2022-11-16T04:25:14Z")

</div>

The issue is that it may not be in the chronological order.  
This kinda worked, let me know if it makes sense:

- Multi relation in Table 2, StockID to StockID
- In table 2, a new look-up column to lookup Reservation status
- In table 2, a if-then column that checks in column in step 2 contains “Open”

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [November 16, 2022, 4:46am UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/4 "2022-11-16T04:46:48Z")

</div>

Okay, if they are not guaranteed to be in chronological order, you can do it as follows:

- Multi relation in Table 2, StockID to StockID
- Rollup in Table 2, taking the latest Reservation Date via the multi relation
- Single Relation in Table 2, matching the Rollup Reservation Date to Table 1 Reservation Date
- Lookup in Table 2, taking the Reservation Status via the Single Relation

---

<div class="post-metadata">

### Author: ![kaustubh97](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kaustubh97/32/16113_2.png) [@kaustubh97](https://community.glideapps.com/u/kaustubh97)
#### Post date: [November 16, 2022, 10:28am UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/5 "2022-11-16T10:28:32Z")

</div>

You can create a conditional relation which will be stock id + open and the you can use a lookup

---

<div class="post-metadata">

### Author: ![jcmaad](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jcmaad](https://community.glideapps.com/u/jcmaad)
#### Post date: [November 17, 2022, 12:44am UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/6 "2022-11-17T00:44:00Z")

</div>

How can i create a conditional relation?

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [November 17, 2022, 1:32am UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/7 "2022-11-17T01:32:02Z")

</div>

With a template. But I don’t think that will help in this case because a single relation returns the first matching row, which means you’d be getting the earliest date, not the latest.

---

<div class="post-metadata">

### Author: ![kaustubh97](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kaustubh97/32/16113_2.png) [@kaustubh97](https://community.glideapps.com/u/kaustubh97)
#### Post date: [November 17, 2022, 6:15am UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/8 "2022-11-17T06:15:48Z")

</div>

Yes using a template column. The template will be stock id + reservation status.  
You can do match multiple here and then use a single value column and using that relation you can get the last value

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [November 17, 2022, 6:21am UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/9 "2022-11-17T06:21:14Z")

</div>

> [@kaustubh97](#):
>
> The template will be stock id + reservation status.  
> You can do match multiple here and then use a single value column and using that relation you can get the last value

They need the _latest_, not the last. This solution is not guaranteed to give the latest unless the records are in chronological order. And they might not be…

> [@jcmaad](#):
>
> The issue is that it may not be in the chronological order.

---

<div class="post-metadata">

### Author: ![kaustubh97](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kaustubh97/32/16113_2.png) [@kaustubh97](https://community.glideapps.com/u/kaustubh97)
#### Post date: [November 17, 2022, 2:27pm UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/10 "2022-11-17T14:27:16Z")

</div>

Okay understood!

---

<div class="post-metadata">

### Author: ![jcmaad](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jcmaad](https://community.glideapps.com/u/jcmaad)
#### Post date: [November 17, 2022, 10:18pm UTC](https://community.glideapps.com/t/look-up-latest-value-from-the-another-table/54257/11 "2022-11-17T22:18:34Z")

</div>

Thanks for suggestions. The solution I outlined works for me and it’s quite elegant. I pull in all Statuses for each StockID and check if contains Open via if-then function.
