# Increment count each time audio file is played

**URL:** <https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901>\
**Category:** Ask for Help\
**Created:** [December 20, 2023, 8:35pm UTC](https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901 "2023-12-20T20:35:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ckinross](https://avatars.discourse-cdn.com/v4/letter/c/3ab097/32.png) [@ckinross](https://community.glideapps.com/u/ckinross)\
**Post date:** [December 20, 2023, 8:35pm UTC](https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901/1 "2023-12-20T20:35:44Z")

</div>

Hello. In my app, I have 5 categories of music.  
Each category has multiple songs.

My goal is to count how many times each song is played, per user.  
How do I apply an action to an audio component so that I can increment the database?

The audio portion for a representative song currently appears like this

 ![Screenshot 2023-12-20 at 12.32.48 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/f/cfff40742617523c7c94f632cf4f61e3755a8016.png)

I’m unable to find a place to add an action. Is this possible in the action editor? If yes, what would be the action recognized by Glide as initiation of an audio file? They don’t need to listen to the complete song to increment the count.

 ![Screenshot 2023-12-20 at 12.33.03 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/6/e69e043db35a85112855ed0537e19602e7807422.png)

---

<div class="post-metadata">

**Author:** ![Lucas\_Pires](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_pires/32/64863_2.png) [@Lucas\_Pires](https://community.glideapps.com/u/Lucas_Pires)\
**Post date:** [December 20, 2023, 8:38pm UTC](https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901/2 "2023-12-20T20:38:49Z")

</div>

For every play it is currently not possible

---

<div class="post-metadata">

**Author:** ![ckinross](https://avatars.discourse-cdn.com/v4/letter/c/3ab097/32.png) [@ckinross](https://community.glideapps.com/u/ckinross)\
**Post date:** [December 20, 2023, 8:47pm UTC](https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901/3 "2023-12-20T20:47:47Z")

</div>

ok, thanks

---

<div class="post-metadata">

**Author:** ![Lucas\_Pires](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_pires/32/64863_2.png) [@Lucas\_Pires](https://community.glideapps.com/u/Lucas_Pires)\
**Post date:** [December 20, 2023, 8:49pm UTC](https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901/4 "2023-12-20T20:49:50Z")

</div>

Once this audio component has no way of adding action, it limits the possibility of adding an increment for each play

---

<div class="post-metadata">

**Author:** ![ckinross](https://avatars.discourse-cdn.com/v4/letter/c/3ab097/32.png) [@ckinross](https://community.glideapps.com/u/ckinross)\
**Post date:** [December 20, 2023, 9:10pm UTC](https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901/5 "2023-12-20T21:10:48Z")

</div>

Let’s try a different approach.

Similar scenario in which

1. User clicks on a song within a list
2. Currently, the action is to show detail screen for this item.  
It looks like this  
 ![Screenshot 2023-12-20 at 1.07.15 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/5/75711e35229daa0af69baab91a9a1efb31fa053a.png)  
 ![Screenshot 2023-12-20 at 1.07.49 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/8/08077534500fe906c6067573d4bdf7a2aa09982a.png)

Those songs are on data sheet called ‘Songs.’

The bit I would like to change is to have the following occur

1. User clicks on a song within the list
2. The detail screen for that song is displayed and a column in the ‘Users’ data sheet called ‘SongCount’ increments by 1.

How do I increment on the ‘Users’ sheet while the action is performed using data from the ‘Songs’ datasheet?

---

<div class="post-metadata">

**Author:** ![Lucas\_Pires](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_pires/32/64863_2.png) [@Lucas\_Pires](https://community.glideapps.com/u/Lucas_Pires)\
**Post date:** [December 20, 2023, 9:16pm UTC](https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901/6 "2023-12-20T21:16:49Z")

</div>

That could work. But think about it, what if the user plays it 2 or more times without having returned to the screen?

---

<div class="post-metadata">

**Author:** ![ckinross](https://avatars.discourse-cdn.com/v4/letter/c/3ab097/32.png) [@ckinross](https://community.glideapps.com/u/ckinross)\
**Post date:** [December 20, 2023, 9:46pm UTC](https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901/7 "2023-12-20T21:46:54Z")

</div>

For this purpose, that’s ok.

How do I increment on ‘Users’ for an action performed on ‘Songs’? The actions will only give me options to choose from the ‘Songs’ columns.  
Would it be something like

1. write to an increment column on ‘Songs’ using the row associated with the particula r song
2. create a LookUp in ‘Users’ to capture the increment
3. clear the increment on ‘Songs’ so the next user can increment as well

This seems like I’m headed in the wrong direction…but not sure at which turn I am wrong.

How would you do this?

---

<div class="post-metadata">

**Author:** ![ckinross](https://avatars.discourse-cdn.com/v4/letter/c/3ab097/32.png) [@ckinross](https://community.glideapps.com/u/ckinross)\
**Post date:** [December 20, 2023, 11:59pm UTC](https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901/8 "2023-12-20T23:59:48Z")

</div>

I found inspiration in Robert Petito’s tutorial on gamification.

> [@Reducing a sheet cell’s value when a form is submitted](https://community.glideapps.com/t/reducing-a-sheet-cell-s-value-when-a-form-is-submitted/8057/5):
>
> Here’s the explanatory video for anyone who wants to be able to track manage/track inventory in Glide. [[Glide: Track Inventory of Items (Explanation)] ](https://www.youtube.com/watch?v=NWlEsbth7q8)

Using a relation column from the Songs sheet to the Users sheet enables me to accomplish my task.  
Thank you

---

<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:** [December 28, 2023, 12:00am UTC](https://community.glideapps.com/t/increment-count-each-time-audio-file-is-played/68901/9 "2023-12-28T00:00:22Z")

</div>

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