Forum Academy Marketplace Showcase Pricing Features

Finding consecutive values in range

Hi Everyone,

I’m needing a quick hand with something. I’m putting together an automatic seating assigner that will select consecutive seats in a row. Heres my set up:

  • In the database I’ve created a table (SEATING) with entries for each row value (Row B Seats 18-34, Row B Seats 37-43).
  • I input the total number of guests into a field (eg 3 guests or 6 guests)
  • On button click a data entry is created in ORDER with a range of assigned seats.

What I need to happen is the workflow to search the SEATING table for an entry of number range that contains the guest count. EG:

Order guest count is 4
Row B Seats 18-34 has 16 seats
Row B Seats 37-43 has 6 seats
Row C seats 1-20 has 20 seats

First match would be ROW B as 18-34 contain 4 consecutive seats, ORDER db entry created would be ROW B SEATS 18,19,20,21 - workflow would change SEATING Row B Seats 18-34 to 22-34 as the first 4 seats are now assigned.

The next order is for 13 GUESTS so the first & second ROW B is not a match as there aren’t 13 consecutive seats available. The match would be ROW C.

The next order is for 5 seats so the first ROW B would be a match as it has 12 seats remaining and so on.

Any ideas on how to achieve this?

Thanks!

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