# Workflow looping is returning unexpected results

**URL:** https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717
**Category:** Ask for Help
**Created:** [December 21, 2024, 2:02am UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717 "2024-12-21T02:02:17Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![gabrielbrown](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gabrielbrown/32/85930_2.png) [@gabrielbrown](https://community.glideapps.com/u/gabrielbrown)
#### Post date: [December 21, 2024, 2:02am UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/1 "2024-12-21T02:02:17Z")

</div>

Hi,

I’m trying to automatically delete a row if a condition is met. I’m attempting to achieve this by using a scheduled workflow that loops through rows in a Glide table.

I have set up my workflow to loop through a database ‘Session Requests’ and filter where an If-Then-Else column ‘Deletion Request?’ is checked. (The “Deletion Request?” returns true when a Query column is empty).

However, when the workflow runs, it deletes all rows in the database. As pictured, despite only one row returning a true Deletion Request, the replay shows that Glide processed both rows as meeting the filtering conditions.

Maybe I’m missing something, and I’d appreciate your help!

Thanks

Session Request Database (before running workflow):

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

Workflow configuration:

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

‘Session Requests’ after running workflow:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/7/37bbecf2da6b466f0d6f5b32db690267272f812f.png)

Workflow replay:

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

---

<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: [December 21, 2024, 9:49am UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/2 "2024-12-21T09:49:33Z")

</div>

Can you share the configuration of the “Deletion Scheduled?” column please?

---

<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: [December 22, 2024, 12:35am UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/3 "2024-12-22T00:35:25Z")

</div>

Any chance your query relies on a datetime column?

---

<div class="post-metadata">

### Author: ![Andrew\_Davies](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/andrew_davies/32/41838_2.png) [@Andrew\_Davies](https://community.glideapps.com/u/Andrew_Davies)
#### Post date: [January 10, 2025, 5:08pm UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/4 "2025-01-10T17:08:33Z")

</div>

Hello there

I have this exact same issue. I am trying to set up a scheduled workflow which deletes redundant rows from a table so it doesn’t get too big. A redundant row is when a relation is empty (so all rows in the parent table that relate to that row are deleted).

My loop (which is sent to return only rows with the related column empty) - returns all rows.

See screenshots.

Any suggestions? I tried doing a count of relations, but that didn’t work.

Andrew

 ![Screenshot 2025-01-10 at 17.02.26](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/d/eda91cf453ceb17b74fd1f6265c4993a1b61cf6f.png)  
 ![Screenshot 2025-01-10 at 17.07.42](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/6/e65de4310e31b97784081972d82534675b03bb57.png)  
 ![Screenshot 2025-01-10 at 17.08.14](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/3/03b75efcf8761aabdbc94bd70dd3c1c534b5ad03.jpeg)

---

<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: [January 10, 2025, 9:20pm UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/5 "2025-01-10T21:20:36Z")

</div>

How is the relation created?

---

<div class="post-metadata">

### Author: ![NFNHello](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nfnhello/32/3371_2.png) [@NFNHello](https://community.glideapps.com/u/NFNHello)
#### Post date: [January 10, 2025, 11:59pm UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/6 "2025-01-10T23:59:27Z")

</div>

I had the same issue where my boolean that determined the loop was made based on an AI text to date column. Support said that the AI column wasn’t supported in scheduled workflows. I rebuilt the text to date manually and it worked as expected. I’m guessing that once you dig into your “QueryFacilitator” query, you might find what’s going on.

---

<div class="post-metadata">

### Author: ![Andrew\_Davies](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/andrew_davies/32/41838_2.png) [@Andrew\_Davies](https://community.glideapps.com/u/Andrew_Davies)
#### Post date: [January 11, 2025, 10:22am UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/7 "2025-01-11T10:22:28Z")

</div>

Thanks both

It’s a straightforward relation.

The “master” table splits a single JSON query into 50 rows using an index and query json columns based on the index (using Bob’s tip of getting all row IDs then find index)

As I need to record some extra information against each row, I have a relation to another table on a unique field that doesn’t change. I can’t add columns as the index value may change so the rows would change.

As the JSON is a list of sequential transactions, and I can only store 50 (which doesn’t matter. That’s plenty) - some drop off the bottom.

I want this workflow to delete the rows with no relation as they are not needed anymore.

That’s the crux of it at least!

---

<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 11, 2025, 2:53pm UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/8 "2025-01-11T14:53:15Z")

</div>

Is there any where in your flow you reference something related to the users table?

---

<div class="post-metadata">

### Author: ![NFNHello](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nfnhello/32/3371_2.png) [@NFNHello](https://community.glideapps.com/u/NFNHello)
#### Post date: [January 11, 2025, 3:00pm UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/9 "2025-01-11T15:00:02Z")

</div>

Or User Specific Columns

---

<div class="post-metadata">

### Author: ![Andrew\_Davies](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/andrew_davies/32/41838_2.png) [@Andrew\_Davies](https://community.glideapps.com/u/Andrew_Davies)
#### Post date: [January 11, 2025, 6:57pm UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/10 "2025-01-11T18:57:15Z")

</div>

Nope - neither

---

<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 12, 2025, 1:15am UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/11 "2025-01-12T01:15:26Z")

</div>

Might be worth reporting it in the beta Slack channel (if you’re there).

---

<div class="post-metadata">

### Author: ![Andrew\_Davies](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/andrew_davies/32/41838_2.png) [@Andrew\_Davies](https://community.glideapps.com/u/Andrew_Davies)
#### Post date: [January 12, 2025, 8:56am UTC](https://community.glideapps.com/t/workflow-looping-is-returning-unexpected-results/78717/12 "2025-01-12T08:56:46Z")

</div>

Will do.
