However, I want to write the number of days OR the number of hours from this booking into the database IN THE RIGHT place. As you can see, I have states for both, but how can I put the logic when hours->write to hours field and when days->write to the day field in the DB?
Just use 2 variables (group data) with conditional datasources.
var Booked Hours
if booked by hours set as the number of hours
If booked by days, leave empty
var Booked Days
if booked by Days set as the number of Days
if booked by Hours leave empty.
Or, in your case, as you’re using Custom States (it makes it slightly more complicated) just don’t set both custom states - only set the correct one (i.e. Days for Days and Hours for Hours).