Predefined Calculation: Bartec Collective - Chosen Booking is Available
This formula will verify that a chosen date for a Bulky or Scrap Metal Collection is still available to be booked.
The formula requires integration with Bartec Collective to be configured. This can be done under Settings > Integrations > Bartec Collective.
Specifically the formula relies upon the settings:
- Bulky Collections Name Match
- Maximum Bulky Waste Collections Per Work Pack
- Maximum Scrap Metal Collections Per Work Pack
This formula requires 2 inputs to be passed through to it:
the Booking Work Pack
This should be mapped to the workpack ID obtained from the "Bartec Collective - Date Selector" component
the Booking Type
Choose between Bulky and Scrap Metal.
|Yes||If the specified workpack still has capacity|
|No||If there is no capacity, or there is an error contacting Bartec Collective|
Note: return values are case sensitive
A check is made to see if the integration has been enabled in the Settings > Integrations page. If the integration is not enabled the formula returns No.
If Booking Type is Bulky a call is made to Workpacks_Metrics_Get, passing the Workpack ID.
The workpack actions are iterated and jobs matching the name set in the setting Bulky Collections Name Match are counted.
If Booking Type is Scrap Metal a call is made to Jobs_Get, passing in the Workpack ID.
The jobs returned are iterated and the jobs matching the name set in the the setting Bulky Collections Name Match are counted.
The number of jobs returned are then compared against the settings
Maximum Bulky Waste Collections Per Work Pack when Booking Type is Bulky
Maximum Scrap Metal Collections Per Work Pack when Booking Type is Scrap Metal
If the number of jobs is less than the maximum Yes is returned, otherwise No is returned.