# Button Function: Select Data Randomly with Condition

**URL:** <https://community.glideapps.com/t/button-function-select-data-randomly-with-condition/84044>\
**Category:** Ask for Help\
**Created:** [August 27, 2025, 5:51am UTC](https://community.glideapps.com/t/button-function-select-data-randomly-with-condition/84044 "2025-08-27T05:51:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nacre\_studio](https://avatars.discourse-cdn.com/v4/letter/n/35a633/32.png) [@nacre\_studio](https://community.glideapps.com/u/nacre_studio)\
**Post date:** [August 27, 2025, 5:51am UTC](https://community.glideapps.com/t/button-function-select-data-randomly-with-condition/84044/1 "2025-08-27T05:51:00Z")

</div>

This is a follow up to my [previous post](https://community.glideapps.com/t/button-function-pulling-data-randomly-user-specific/82599).

In this app, the user selects a studio activity type and a page will appear with an associated activity.

 ![Layout_StudioType](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/1/71f381deb6eb996cae39980d2eefc3aad45f19af.jpeg)

At the end of the activity there is a “complete” button.

 ![Layout_ActivityNotComplete](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/d/ad93c5dab778512705fe3c2f41f3faaf8ff99790.jpeg)

The “complete” button triggers “complete” on the Activity Table, which will also add a value to progress tables on the User Table.

 ![Layout_ActivityComplete](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/7/77f6f42d40c0374f3c20c30709ab2b9053d17a25.jpeg)

My goal is that when a user clicks a studio type, it will bring up an activity within that type that has NOT been completed yet, randomly.

This is not functioning yet… Could someone help assist me in repairing workflows or re-organizing to help? Let me know if any other screen shot references could help - thank you!

**Activity Table:**

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

**User Table:**

 ![UsersTable](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/1/018e2f4700c39aebdc355b279fe3d318cd172583.jpeg)

**Workflow for the button to activate “Complete”:**

 ![Workflow_Complete](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/7/47468396b17064672dab5b5be1151b75a535feb2.jpeg)

**Workflow for the button that is already “Complete”:**

 ![Workflow_AlreadyComplete](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/0/60f364f4246f4301696d633611169b87eeada460.jpeg)

---

<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:** [August 28, 2025, 1:30am UTC](https://community.glideapps.com/t/button-function-select-data-randomly-with-condition/84044/2 "2025-08-28T01:30:22Z")

</div>

> [@nacre\_studio](#):
>
> The “complete” button triggers “complete” on the Activity Table, which will also add a value to progress tables on the User Table.

I don’t think you need to do an increment on the progress here if I understand your structure correctly. You can just do a rollup on top a query/relation.

> [@nacre\_studio](#):
>
> My goal is that when a user clicks a studio type, it will bring up an activity within that type that has NOT been completed yet, randomly.

How do you define “bring up”? Does it show a new screen or something else?

Regardless, you should be able to have a query of incomplete activities, and then have a single value column to return a random row from the query.

---

<div class="post-metadata">

**Author:** ![nacre\_studio](https://avatars.discourse-cdn.com/v4/letter/n/35a633/32.png) [@nacre\_studio](https://community.glideapps.com/u/nacre_studio)\
**Post date:** [September 2, 2025, 11:58pm UTC](https://community.glideapps.com/t/button-function-select-data-randomly-with-condition/84044/3 "2025-09-02T23:58:35Z")

</div>

Thank you – How do I do a rolll up? I’m not sure I follow.

Correct, when a user clicks a studio type the workflow is - show detail screen, Target:Overlay. So far that seems to be working.

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

I’m wondering if my workflow is referencing the activity table in some way and if I need more "user specific” workflows, maybe I need more reference columns in the user table?

---

<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:** [September 3, 2025, 4:56am UTC](https://community.glideapps.com/t/button-function-select-data-randomly-with-condition/84044/4 "2025-09-03T04:56:34Z")

</div>

> **[Rollup Column | Glide Docs](https://www.glideapps.com/docs/automation/computed-columns/rollup-column)**
>
> Perform calculations on columns, such as count, average, and sum.
