How to Use IF Statements for Text Output in Plecto

0 comments

Plecto uses IF-statements within its formula editor to trigger dynamic text updates on dashboards based on real-time data thresholds. By combining data functions like SUM with specific filters, users can automate motivational messages or status alerts that change instantly when a KPI reaches a predefined value.

Building a Dynamic Text Trigger in Plecto

Plecto’s formula engine allows users to transform raw numbers into readable status updates. To create a text-based trigger, the IF function evaluates whether a specific data condition is met. If the condition is true, the widget displays the first designated text string; if false, it displays the second.

According to Plecto’s documentation, a standard formula follows this logical structure: IF(Sum, Sales, State="success", Amount, 50000, "Target Reached 🎉", "Working on it 💪").

Breaking Down the Formula Components

To implement a functional IF-statement, you must define the following elements within the formula editor:

  • The Data Function: The IF function.
  • The Connection and Source: Sum (the data connection) and Sales (the data source).
  • The Filter: This restricts the data. For example, setting State="success" ensures the formula only counts records where the State field values are “success”. Plecto filters are case-sensitive.
  • The Target Field: The field whose values are to be summed, such as Amount.
  • The Threshold: The target value (e.g., 50,000) that triggers the text change.

Customizing Visual Feedback and Colors

Users can assign specific colors to the resulting text strings. For instance, a formula can be set to display “Target Reached 🎉” for green and “Working on it 💪” for yellow.

Customizing Visual Feedback and Colors

Handling Empty States and Null Values

If you do not want to display a message when the target is not reached, you can leave empty quotation marks in the statement, such as: “Target Reached 🎉”,” “. There must be a single space between the quotation marks – otherwise the widget displays 0 instead of nothing.

Quick Implementation Guide

Goal Formula Logic Visual Result
Track Goal Completion IF(Sum, Sales, State=”success”, Amount, 50000, “Target Reached 🎉”, “Working on it 💪”) Text switches based on value
Clean Dashboard “Target Reached 🎉”,” “ Text is hidden until goal is hit

Related Posts

Leave a Comment