Skip to main content

Bartec Collective - Non Collection Events

  • What is it? This formula will return a list of non collection events at a property from Bartec Collective.

Note that this formula will not return non collection street events such as access to the street is blocked.

Setup

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

Residual Waste Name Match

The value entered into the setting must partially match the description of the residual features as configured in Bartec Collective.

For example if in Bartec Collective your features are named as:

  • RESIDUAL 160L
  • RESIDUAL 240L
  • RESIDUAL 550L

You would enter RESIDUAL into the setting as the value as that will match all organic features

Recycling Name Match

The value entered into the setting must partially match the description of the recylcing features as configured in Bartec Collective.

For example if in Bartec Collective your features are named as:

  • RECYCLING 160L
  • RECYCLING 240L
  • RECYCLING 550L

You would enter RECYCLING into the setting as the value as that will match all organic features

Inputs

This formula has 2 inputs that can be passed through to it, the UPRN of the property to check for non collection events against and optionally a styling class.

The UPRN mapped value must come from an address lookup question, using the propery_identifier variable option.

The styling class is optional and can be left blank, if any styling is required on the output Spacecraft can advise on what value you should enter into this mapping input. The value will correspond to a CSS class.

Return values

ValueDescription
[HTML]HTML unordered list markup of non collection event descriptions that can then be inserted into page instructions
street-not-completeIf the street has not yet been marked as complete by the crew the formula will return this value
falseIf the street collections have been marked as complete in Bartec Collective and the property has no premises events recorded against it in Bartec Collective, or if there is an error connecting with the Bartec Collective API

Note: return values are case sensitive

Caching

When using this formula the calls to the Bartec Collective API are cached for the time specified in Settings > Integrations > Bartec Collective > Settings under the Cache Timeout setting.

Setting the Cache Timeout to 0 Minutes/Hours will disable caching on this formula.

Formula Logic

  1. 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.

  2. A call is made to Premises_Get passing in the UPRN. If the integration is not enabled the formula returns false.

  3. The Unique Street Reference Number (USRN) for the property is extracted from the response of the Premises_Get call.

  4. A call is made to Streets_Events_Get passing in the USRN from step 3 and calculated start and end dates.

    Start Date: If the current time is before 16:00 the start date is set to the previous day, if the current time is equal to or after 16:00 the start date is set to the current day.

    End Date: The end date is the start date plus 1 day.

  5. For all street events returned the event description is compared with 'STREET COMPLETE' (case sensitive). If no street events have the description 'STREET COMPLETE' the formula will return street-not-complete at this point and no further processes take place.

  6. Next a call to Premises_Events_Get is made passing in the UPRN of the property from the mapped input UPRN and calculated start and end dates.

    Start Date: If the current time is before 16:00 the start date is set to the previous day, if the current time is equal to or after 16:00 the start date is set to the current day.

    End Date: The end date is the start date plus 1 day.

  7. The formula then checks if there are any premises events returned, if no events are returned the formula will return false indicating that the street collection has been marked as compelete and no non-collection events are recorded against the property.

  8. For each premises event returned from the call to Premises_Events_Get the event is formatted into a list item with the following format:

    <li>[Bin.Type] bin because it was: [EventType.Description]
    </li>

    Where [Bin.Type] is determined by inspecting the event feature description and comparing it to the values configured for the name matches in Settings > Integrations > Bartec Collective > Settings. Where the feature description contains the value of Garden Feature Name Match the bin type will be Garden waste, Where it contains the value of Residual Waste Name Match the bin type will be Household waste and where it contains the value of Recycling Name Match the bin type will be Recycling waste.

    The comparison is case insensitive.

  9. The list items are then wrapped around an HTML paragraph (P) tag that has the styling class applied to it and returned. Example output:

    <p class="[Styling.Class]">Our crews did not empty your: <ul>[Event.List]</ul></p>

    Where [Styling.Class] is the value of the Styling Class input on the formula and [Event.List] is the output of step 8.