# How can I sequence database updates?

**URL:** <https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642>\
**Category:** Ask for Help\
**Created:** [November 17, 2021, 5:10am UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642 "2021-11-17T05:10:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Malcolm\_Lewis](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@Malcolm\_Lewis](https://community.glideapps.com/u/Malcolm_Lewis)\
**Post date:** [November 17, 2021, 5:10am UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642/1 "2021-11-17T05:10:24Z")

</div>

See screenshot. I have a button action that needs to:

First, create a new Item  
Second, create a new Post that associates the current User with the new item

Occasionally, the post and item are both created (desired), but the post is missing the itemID (problem) — so I have a post that doesn’t reference an item.

I’m guessing it’s a timing issue. Is there a way to ensure that the _Add Row to Items_ step always completes before the _Add Row to Posts_ step starts?

Hope I’m explaining that correctly.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/b/ebd19fa206428b56b795cebe34b48e3cff258e79.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:** [November 17, 2021, 5:23am UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642/2 "2021-11-17T05:23:40Z")

</div>

> [@Malcolm\_Lewis](#):
>
> I’m guessing it’s a timing issue. Is there a way to ensure that the _Add Row to Items_ step always completes before the _Add Row to Posts_ step starts?

Yep.  
And no, there is no way to guarantee that.

The usual way to approach this is to set a [Unique Identifier](https://docs.glideapps.com/all/reference/values/special-values/unique-identifier) in a User Specific Column somewhere prior to the action sequence, and then use this value as a common ID for both Add Row actions.

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [November 17, 2021, 5:31am UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642/3 "2021-11-17T05:31:41Z")

</div>

where is this item ID coming from? if is missing, probably is not in the source

---

<div class="post-metadata">

**Author:** ![Malcolm\_Lewis](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@Malcolm\_Lewis](https://community.glideapps.com/u/Malcolm_Lewis)\
**Post date:** [November 17, 2021, 9:14am UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642/4 "2021-11-17T09:14:08Z")

</div>

The ItemID for the Add Post step comes from the prior Add Item step.

The problem appears to be timing.

Both steps always execute.

But I need a way to ensure that Add Item always completes before Add Post starts.

---

<div class="post-metadata">

**Author:** ![MIKAHEL](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikahel/32/25039_2.png) [@MIKAHEL](https://community.glideapps.com/u/MIKAHEL)\
**Post date:** [November 17, 2021, 9:15am UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642/5 "2021-11-17T09:15:48Z")

</div>

Try to put in the middle Go Back! since it is a function to change screen, may give you the necessary time lapse.

---

<div class="post-metadata">

**Author:** ![Malcolm\_Lewis](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@Malcolm\_Lewis](https://community.glideapps.com/u/Malcolm_Lewis)\
**Post date:** [November 17, 2021, 4:19pm UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642/6 "2021-11-17T16:19:07Z")

</div>

Thanks, yes that’s an idea. In other platforms (Bubble) you could introduce a delay of n seconds into any workflow. Helpful for situations like this.

---

<div class="post-metadata">

**Author:** ![\_eric](https://avatars.discourse-cdn.com/v4/letter/_/5f9b8f/32.png) [@\_eric](https://community.glideapps.com/u/_eric)\
**Post date:** [November 17, 2021, 4:41pm UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642/7 "2021-11-17T16:41:04Z")

</div>

It would be nice to have a wait condition (wait 30 seconds, wait 1 minute, wait 1 day…).

---

<div class="post-metadata">

**Author:** ![Malcolm\_Lewis](https://avatars.discourse-cdn.com/v4/letter/m/5f9b8f/32.png) [@Malcolm\_Lewis](https://community.glideapps.com/u/Malcolm_Lewis)\
**Post date:** [November 17, 2021, 5:19pm UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642/8 "2021-11-17T17:19:52Z")

</div>

Even nice would be a Wait for Prior Step to Complete condition. That would work 100% of the time.

Until then, I’ll try Darren’s solution using a pre-set UID shared by both Add Item steps.

---

<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:** [November 18, 2021, 12:23am UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642/9 "2021-11-18T00:23:21Z")

</div>

> [@Malcolm\_Lewis](#):
>
> Even nice would be a Wait for Prior Step to Complete condition. That would work 100% of the time.

I’m 100% up for this.

---

<div class="post-metadata">

**Author:** ![MIKAHEL](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mikahel/32/25039_2.png) [@MIKAHEL](https://community.glideapps.com/u/MIKAHEL)\
**Post date:** [November 18, 2021, 5:25am UTC](https://community.glideapps.com/t/how-can-i-sequence-database-updates/34642/10 "2021-11-18T05:25:38Z")

</div>

please, let me know if this worked out!
