Predefined Calculation: Whitespace PowerSuite - Next Collections Table
This formula will return an HTML table of next collection dates by service. It contains two columns: Service Name and Next Collection Date, which have configurable headings.
This formula requires 5 inputs to be passed through to it:
the UPRN of the property to display data for
The mapped value must come from an address lookup question, using the propery_identifier variable option.
the date format
This input determines how dates are formatted in the Next Collection Date column, e.g. "d/m/Y".
the styling class
A CSS class output on the table element in the HTML, to help with styling (only output on web and embedded form views. Internal forms inherit control centre table styling)
the Service column heading
Allows configuration of the heading of the first column in the table.
the Next Collection Date heading
Allows configuration of the heading of the second column in the table.
|An HTML table||If there is one or more services found for the property with a valid next collection date|
|An empty string||If there are no available dates, or an error occurred.|
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 an empty string.
A call to Whitespace PowerSuite's GetCollectionByUprnAndDate endpoint is made, passing the UPRN and the current date.
A HTML table is built.
The returned collections are iterated over. For each returned collection, we add its Service and Date properties as a row in the table if that Service has not already been added already.
If the table contains any rows, its HTML is returned as the result of the calculation. If not, an empty string is returned.