Play audio when repeating group finds data

I have a repeating group, that searches for “TaxiBookings”, that have the same driver that is logged in, if that makes sense.

When a new booking is created and it goes into the RG I would like the audio to play. Don’t know if possible but would be so helpful.

Yes with the plugin Audio Player from ZQ. It load and play.

How do I make it play when the repeating group finds a data?

Hi @cliffwoodjames, you can simply change with a new audio file. Try it, and let me know. Are you using a RG with 1 row 1 column?


image


actions:
03%20AM

I don’t yet have the plugin, as I am not on a paid plan and cannot get it.

Trying the plugin is free, but yes you have to be on paid 16$ plan (at least for one month).

Can it be done through java script?

Yes, all plugins are copied of javascript library (almost).

1 Like
1 Like

Hiya, I followed your tutorial. I just don’t know how to get it to play when the RG finds a new booking. @Bubbleboy

Try using the ‘Trigger a custom event when data changes’ workflow action.

Apply a condition to the ‘Do when a condition is true’ workflow. Could be when a new booking is made or something like that.

Set the workflow event to ‘Everytime’
image

The field to watch would be the related to the ‘Type of thing’ set in the custom event which is ‘TaxiBookings’ with the field to watch then being ‘DriverUser’.

Then on the custom event could be the JS for the audio to play and you could use a condition on the Custom workflow so that only when ‘Current workflow TaxiBooking DriverUser is current user’

Haven’t tested but something like this should work…If you setup a test environment I can check

1 Like

Hey Luke, think I’m getting there.

Then on the custom event could be the JS for the audio to play and you could use a condition on the Custom workflow so that only when ‘Current workflow TaxiBooking DriverUser is current user’

Is the bit where I’m a little confused. What should I put here?image

- Custom Event

The Workflow data can be the repeating group (if the data type matches which is should do) or you can ‘Do a search for’ and filter/constrain any data you need.

Don’t know if I am being stupid here.

Try :Last item as its expecting a single item. The last item should be the latest, can also be changed with the :sorting modifier to most recent (from the created date) as last entries.

1 Like

Done that, but still doesnt play the audio.


Can you create a clone of the page with the data so I can take a look? Or provide the editor via private message.

Hey @cliffwoodjames

Looking into this and creating a similar type setup to yours, this is possible. Here are the necessary steps, but just note, in production with hundreds of users results may vary due to the high workflow rate, so something to bear in mind and test.

See the example page I setup that does a live demo:

I suggest opening 2 web browsers. Click the ‘Login as John’ on 1st web browser, this logs you in as a driver, you’ll then be able to see the relevant bookings in the repeating group to the right, as they come in. Then on the 2nd web browser, you can create a new booking, by selecting the driver and then clicking the ‘Create a new booking’ button.
You should then see the new entry load in and hear the notification sound run. The sound is sometimes played once or twice depending on timing of the workflow event running. This is due to the setup of using the range of 2 seconds, more explain below:

Create a new workflow on the page:
image

You can set the interval to lower values e.g. 0.5, but for performance I think 1 is fine.

Now in the repeating group we are searching for entries on the ‘TaxiBookings’ data type:
image
The entries will only be show to the current user who is the driver. Privacy rules would need to reflect this too.

Anyhow, onto the Javascript step.
image

The ‘Only when’ condition is important here and thats whats being run every 1 second. Firstly it will create a 2 second window using the range modifier. This will be the current date/time along with an extra 2 seconds. The reason for this range is that the workflow was unreliable if it was exact e.g. contains or is using an exact date/time in either date format or text when compared.
It wasn’t quick enough it appears to check the conditions and then run the workflow. Some improvements and experimentation could be made here, but from a quick test worked. As mentioned sometimes in this period the audio workflow action will run once or twice depending how it catches in the date/time range.
We then match the time window to the repeating groups last items creation date.

3 Likes

I know this was done a long time ago, but i am also wondering how to do this. Ur explain is beyond me, and i do not understand… If you have discord, and could help on a call, that would be awesome.