Tuesday Tips: Conditional Block Helpers

Conditional Block Helpers provide an easy way to compare values and add a little logic within templates in the Losant Workflow Engine and Dashboards. These Helpers can be used in any field that is templatable, and can be useful to conditionally view data.

Workflow Engine

Conditional Block Helpers in a workflow can be used in many ways. In my use case, I have a device that sometimes reports data, and sometimes does not. I would like to visualize in a workflow in my Debug Panel if no data was sent by my device. I can use the #match helper to easily see in my debug message if no data was attached to my payload:

When "data" is empty on my payload, then data will match the empty string (‘’). Now I can easily see in my Debug Panel when my device reported no data!


Conditional Block Helpers can be extremely useful in a dashboard when limiting data. In my use case, I have a device with a GPS location that I am displaying in a GPS History Block. I currently have an #if helper to show my first and last point:

However, I would like to change the last point color marker to black if it is greater than a certain longitude. I can do this with the #gt helper and an {{else}}:

In this conditional statement, if the most recent GPS point has a longitude greater than 22, the marker will turn black, making it clear to me that my device is too far outside the country!

Conditional Block Helpers can be utilized in many ways in workflows and dashboards, so check them out and let us know your great use cases below!

Thanks for stopping by for our Tuesday Tip, see you next time :woman_technologist:t4: