# Is this possible? Picking a value from a column at random with a set column action…

**URL:** https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685
**Category:** Ask for Help
**Created:** [June 5, 2021, 7:43pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685 "2021-06-05T19:43:11Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)
#### Post date: [June 5, 2021, 7:43pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/1 "2021-06-05T19:43:12Z")

</div>

The use case:

A user is ready to make a video call with an agent  
There are agents available (agent table, and a Boolean is available = true)  
The user clicks on a button “lets go”  
….

Is it possible to have a compound action that:

- picks an email at random from the available emails
- writes it the ‘this item’ row

(I have other messy things afterwards, but this is one piece of a possible solution).

Thanks!

---

<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: [June 5, 2021, 7:57pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/2 "2021-06-05T19:57:31Z")

</div>

get max available agents and do this formula in Gsheet  
=ROUNDUP( RAND()\*max(agents row number))  
you need to first filter all available agents, and have column with ROW() numbers…  
than just filter the agent with the result row number

---

<div class="post-metadata">

### Author: ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)
#### Post date: [June 5, 2021, 8:10pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/3 "2021-06-05T20:10:44Z")

</div>

Thanks…. Thinking through more of the situation:

Agents is a GS table - mostly static content  
50+ agents…. But only 5-10 might be available to be assigned

I need to do as much as possible within glide - as the 5-10 second time lag is the actual reason for my problem. ((Currently an agent assigns themself a user, BUT they write into a single column, say ‘email assign’ but the other devices might have someone else come in during the 10 second delay…. Overwriting the first)). ((And this is the GT in the same app)).

I’d also need to get the agent values somehow. I did try to do a single value from an if-then-else in the agent table in glide …. But it was picking up blank values as real values :(((

---

<div class="post-metadata">

### Author: ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)
#### Post date: [June 5, 2021, 8:11pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/4 "2021-06-05T20:11:17Z")

</div>

I think so!

1- Create a Simple Value Column using the Random option

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/9/09ca2c7d51a535664e516489d6340d8669de9b11.png)

2- later, use a Reshuffle action to have a newer list at anytime

Saludos Mark

---

<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: [June 5, 2021, 8:11pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/5 "2021-06-05T20:11:56Z")

</div>

you wont have a delay, because is pre calculated

---

<div class="post-metadata">

### Author: ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)
#### Post date: [June 5, 2021, 8:14pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/6 "2021-06-05T20:14:06Z")

</div>

How do you handle blanks? 50 agents, only 5 free = 45 blanks.

---

<div class="post-metadata">

### Author: ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)
#### Post date: [June 5, 2021, 8:15pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/7 "2021-06-05T20:15:53Z")

</div>

Youd need to relate the list of avail emails to the sheet of emails and then use a single value on the relation.

---

<div class="post-metadata">

### Author: ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)
#### Post date: [June 5, 2021, 8:17pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/8 "2021-06-05T20:17:30Z")

</div>

Ummm… let me try and play with a Joined List!

---

<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: [June 5, 2021, 8:23pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/9 "2021-06-05T20:23:30Z")

</div>

i made you a sample in our team sheet @Mark_Turrell

 ![Screen Shot 2021-06-05 at 4.38.12 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/0/900b91ef00c3797e8c308cc395115c5be61e003e.png)

=roundup(rand()\*(MAX(F2:F)))

 ![Screen Shot 2021-06-05 at 4.47.36 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/c/fca873c1c92c9f3874c8532ebc6847cd08d5854e.png)

---

<div class="post-metadata">

### Author: ![Mark\_Turrell](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mark_turrell/32/26605_2.png) [@Mark\_Turrell](https://community.glideapps.com/u/Mark_Turrell)
#### Post date: [June 5, 2021, 8:44pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/10 "2021-06-05T20:44:52Z")

</div>

Thanks! I’ll have a play tomorrow 🙂 much appreciated:)

---

<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: [June 5, 2021, 10:33pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/11 "2021-06-05T22:33:50Z")

</div>

if i could suggest you deferent way… not by random… but which agent is waiting the longest… random might use one agent more often than others. So just put the timestamp when agent pick up the call and sort them by earliest time first. and in this case blank values by default are the earliest (in Glide, and latest in G sheets) and i would randomize only blank timestamps if there are any)  
I added a new version in TEAM Sheet. @Mark_Turrell

 ![Screen Shot 2021-06-05 at 7.34.01 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/2/4208c494549f8b7a9c4239abdb8cbf1e7368a431.png)

---

<div class="post-metadata">

### Author: ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)
#### Post date: [June 6, 2021, 1:18am UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/12 "2021-06-06T01:18:04Z")

</div>

Hi,  
I cobbled together something to pick an agent almost at random.  
You need a trigger to generate a number, so if you give each user a number when they arrive (or by one button), it triggers a random one and therefore an agent selection.  
It’s not the top of the random, but if it’s for all the agents have a work, it does the job.  
Here is a small test application.

> **[False Random](https://falserandom.glideapp.io/)**

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

there is a link to a documentation for the random generation. in case !

---

<div class="post-metadata">

### Author: ![Joe\_Gabriele](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/joe_gabriele/32/57595_2.png) [@Joe\_Gabriele](https://community.glideapps.com/u/Joe_Gabriele)
#### Post date: [June 6, 2021, 6:47am UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/13 "2021-06-06T06:47:31Z")

</div>

Could you use a compound action that when an Agent makes themselves available, it not only changes a boolean, but also sets a Date/Time Column with current date and time?

Then you can sort the list of available agents based on latest time available and assign a person to the first agent in the list.

And once assign, set Agent to not available.

This would be a more fair round robin vs random.

---

<div class="post-metadata">

### Author: ![xaviigna](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/xaviigna/32/29090_2.png) [@xaviigna](https://community.glideapps.com/u/xaviigna)
#### Post date: [October 28, 2021, 4:31pm UTC](https://community.glideapps.com/t/is-this-possible-picking-a-value-from-a-column-at-random-with-a-set-column-action/27685/14 "2021-10-28T16:31:51Z")

</div>

Do you have any example?
