When user books a class, the 'spaces available' should go down by 1

Hey,

Each class date has X number of spaces available.

When a user ‘books’ a class, the number of spaces available should - 1.

For example, if the class has 8 spaces available for the 1st November, and the user books the class for this date, then there should be 7 spaces available for the 1st November.

I’ve got this semi-working. Currently, when a user books the class, it minuses 1 from ALL available dates, not just the date they have selected.

I’ve tried a few different methods and I can’t get it to target just one date (I’ve tried methods that have had it target the first item which didn’t work, along with the current method I’m using).

Editor: (removed)

Any ideas?

Thanks!

It looks like you want “make changes to a thing”, not “make changes to a list of things”.

Currently, you’re changing the ‘spaces available’ field for the entire repeating group worth of CalendarSchedulings.

You want something to the effect of:

Make changes to a thing

Thing to change: Current Cell’s CalendarScheduling
change field: Spaces Available = Current Cell’s CalendarScheduling’s Spaces Available - 1

Hope that helps :slight_smile:

1 Like

I initially tried Make changes to a thing but couldn’t populate it with fields that didn’t throw up an error.

I can’t make Thing to change: Current Cell’s CalendarScheduling - it doesn’t give me the option (maybe because it’s not in the Repeating Group?

So my next idea was to ‘Do a Search for’ the cell, but that changes ‘make changes to a thing’ to ‘make changes to a list of things’ and still didn’t work :frowning:

Sounds like that’s the issue. If the button was in the cell, you’d have that option.

Yes, doing a search for things will give you a list of things, which prevents using make changes to a thing. Try doing a search for the relevant CalendarScheduling then selecting ‘:First Item’. If you’re confident that the search is only returning one item, that should do the trick.

1 Like

The only issue is that I want the user to first select a time, then enter their payment information, and then click the ‘book’ button (Image below, minus the Stripe payment forms), so I can’t put the book button in the RG itself:

When I selected ‘:First Item’, it would only -1 from the first date (e.g. Wednesday Nov 1st in the example above).

Eeeh, frustrating!

Set a state on select, which is the thing they selected (Calendar Scheduling)

image

Replace the “make changes to list” with a change to that thing.

Update it.

image

1 Like

Ah perfect, it seems so simple now. Thank you Nigel!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.