# Get data from a query property (API)

**URL:** <https://community.glideapps.com/t/get-data-from-a-query-property-api/74927>\
**Category:** Ask for Help\
**Created:** [July 15, 2024, 7:35pm UTC](https://community.glideapps.com/t/get-data-from-a-query-property-api/74927 "2024-07-15T19:35:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![evazivanovic](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/evazivanovic/32/83692_2.png) [@evazivanovic](https://community.glideapps.com/u/evazivanovic)\
**Post date:** [July 15, 2024, 7:35pm UTC](https://community.glideapps.com/t/get-data-from-a-query-property-api/74927/1 "2024-07-15T19:35:59Z")

</div>

Hey guys,

I am working on an HR app and there’s a requirement to create new annual leave records each year (every 1st of Jan, we will add 25 days of PTO for each user). However, last year’s remaining days should also be added to the new record (for example if the user had 10 days left last year, the new total of this year’s PTO will be 35).

I was able to create new PTO records but I can’t figure out how to fetch the “remaining days” from last year.

I created a query property to connect last year’s record to this year’s and a lookup to fetch the remaining days but I don’t know how to structure the API call to actually retrieve the remaining days.

The math function doesn’t work because it’s basically looping through records infinitely and Glide is preventing it.

Any ideas?

---

<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:** [July 15, 2024, 7:58pm UTC](https://community.glideapps.com/t/get-data-from-a-query-property-api/74927/2 "2024-07-15T19:58:17Z")

</div>

What you probably need is a Query column to look at the last year records for the user. Then you probably need a Rollup column against the Query to get the total number of remaining days. That’s a bit of rough advice. If you are still struggling, it would help to see screenshots of your data to better understand how you have it all set up.

---

<div class="post-metadata">

**Author:** ![evazivanovic](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/evazivanovic/32/83692_2.png) [@evazivanovic](https://community.glideapps.com/u/evazivanovic)\
**Post date:** [July 15, 2024, 9:36pm UTC](https://community.glideapps.com/t/get-data-from-a-query-property-api/74927/3 "2024-07-15T21:36:10Z")

</div>

Hey Jeff,

Thanks for your insight. I have configured this prior to posting here, here’s my configuration. Now what I need to do is basically whenever I create a new record, I need to fetch the “To Transfer From Last Year” and push it to “Transferred” so I can use it in calculations. This is where I got stuck.

I tried using the rolled up value to calculate “Total Remaining” and “Total Available” but the problem is that Glide didn’t allow it because it would be an endless loop.

 ![Screenshot 2024-07-15 at 23.33.07](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/f/5fc5561a6e09ffa8c1695d1c4a1784cd51423a4f.jpeg)

---

<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:** [July 15, 2024, 9:56pm UTC](https://community.glideapps.com/t/get-data-from-a-query-property-api/74927/4 "2024-07-15T21:56:01Z")

</div>

So does your table contain 1 row per Year-Employee-LeaveType? And does the Manual Adjustment column increment whenever a leave it taken?

Just looking at your first row for Bella, how did you calculate Total Remaining of -11?

And what changes in my life do I need to make to get 180 days of vacation like Daniela? 😉

---

<div class="post-metadata">

**Author:** ![evazivanovic](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/evazivanovic/32/83692_2.png) [@evazivanovic](https://community.glideapps.com/u/evazivanovic)\
**Post date:** [July 15, 2024, 10:38pm UTC](https://community.glideapps.com/t/get-data-from-a-query-property-api/74927/5 "2024-07-15T22:38:50Z")

</div>

Lool 😄 this is just some sample data that’s linked to an “absence tracker”. Each absence is linked to an “annual leave” record depending on what timeframe the absence is in.

So this is how it’s calculated:

Total Available = New + Remaining (info comes from the last chronological record so basically from last year from Total Remaining property) + Manual Adjustment

Total Remaining = Total Available - Spent (rollup from Leave Tracker relation)

And yeah there is only one record per Employee Type Year.

---

<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:** [July 15, 2024, 11:09pm UTC](https://community.glideapps.com/t/get-data-from-a-query-property-api/74927/6 "2024-07-15T23:09:47Z")

</div>

I think what you may need is two more math columns. Think of Total Available and Total Remaining as interim columns that only pertain to that year. What I think you need is another set of columns like Final Available and Final Remaining which sum the values in to Total columns with the value in the To Transfer Rollup column. At least something along those lines. I hope that makes sense.

---

<div class="post-metadata">

**Author:** ![evazivanovic](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/evazivanovic/32/83692_2.png) [@evazivanovic](https://community.glideapps.com/u/evazivanovic)\
**Post date:** [July 16, 2024, 7:01am UTC](https://community.glideapps.com/t/get-data-from-a-query-property-api/74927/7 "2024-07-16T07:01:07Z")

</div>

My god I almost broke my brain on this one 😃 But it worked!! Thanks @Jeff_Hager appreciate your help 🙂

 ![Screenshot 2024-07-16 at 09.00.14](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/4/e4ae5aca09899e4ec6d8ed5a539fce13af552895.jpeg)

---

<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:** [July 23, 2024, 7:01am UTC](https://community.glideapps.com/t/get-data-from-a-query-property-api/74927/8 "2024-07-23T07:01:26Z")

</div>

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