Predefined Calculation: Bartec Collective - Garden Bins at Property
This formula will build a HTML table of all garden bins currently at a particular property.
The formula requires integration with Bartec Collective to be configured. This can be done under Settings > Integrations > Bartec Collective.
The formula requires the following settings to be configured under Settings > Integrations > Bartec Collective > Settings.
Garden Feature Name Match
The value entered into the setting must partially match the description of the organic features as configured in Bartec Collective.
For example if in Bartec Collective your features are named as:
- GARDEN 160L
- GARDEN 240L
- GARDEN 550L
You would enter GARDEN into the setting as the value as that will match all organic features.
This formula requires 2 inputs to be passed through to it:
the UPRN of the property to check.
This should be mapped to the property identifier element of an address lookup question.
a styling class
This is a CSS class which will be applied to the
<table>tag in the output. Use this to apply specific styling to the output.
|A HTML table of all garden bins||This will contain three columns: name of bin, size of bin, and the quantity.|
|false||If there are no garden bins at the property, or an error occurred.|
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 false.
The formula calls Features_Types_Get.
The returned records are filtered, to find only features where the name matches the Garden Feature Name Match setting. If no types are returned, the formula returns false.
The formula then calls Features_Schedules_Get passing the UPRN and the list of garden bin types obtained in step 2. If no schedules are returned, the formula returns false.
The returned schedules are filtered down to only active ones i.e. where the schedules 'From' attribute is in the past, and 'To' is in the future. If there are no active schedules, the formula returns false.
Any schedule with a unique feature ID is added to the list of bins to be shown in the table, unless its feature status is 'PLANNED'.
If the list of bins to be shown in the table is empty, the formula returns false.
The table markup is built from the list of bins created in step 5, and returned as the result of the formula.