Configuring Triggers and Formulas
This guide covers how to configure trigger conditions for data recording and use calculation formulas to process data.
Configure Trigger Conditions
Trigger conditions determine when data is recorded. You can configure multiple triggers for a single table - data is recorded whenever any trigger condition is met.
Trigger Type 1: Tag Trigger
Record data when a tag expression becomes true.
Configuration Steps:
- Click Trigger Configuration
- Click Add → Tag Trigger
- Click Configure Expression
- Build a logical expression using tags and operators
- Select the Result Type:
- Becomes True: Trigger once when expression changes from false to true
- Becomes False: Trigger once when expression changes from true to false
- True/False Change: Trigger on any change
- (Optional) Set Repeat Frequency: Trigger repeatedly while condition remains true
- Click Confirm
📷 [Screenshot: Tag Trigger configuration dialog]
Example Expressions:
| Use Case | Expression | Result Type |
|---|---|---|
| Record when part completes | {Part_Complete} == 1 | Becomes True |
| Record when machine stops | {Machine_Running} == 0 | Becomes True |
| Record on status change | {Status} != PREVALUE({Status}) | True/False Change |
| Record when temp exceeds limit | {Temperature} > 80 | Becomes True |
Trigger Type 2: Scheduled Trigger
Record data at specific time intervals.
Configuration Steps:
- Click Trigger Configuration
- Click Add → Scheduled Trigger
- Set the Start Time
- Set the Repeat Frequency:
- Every X seconds/minutes/hours
- Daily at specific time
- Weekly on specific days
- (Optional) Add a Condition: Only trigger if expression is true
- Click Confirm
Example Schedules:
| Use Case | Start Time | Repeat Frequency | Condition |
|---|---|---|---|
| Record temp every minute | Now | Every 1 minute | None |
| Record production at shift end | 14:00 | Daily | {Production_Active} == 1 |
| Record energy hourly | 00:00 | Every 1 hour | None |
Trigger Type 3: Field Change Trigger
Record data when a field value changes.
Configuration Steps:
- Click Trigger Configuration
- Click Add → Field Change Trigger
- Select one or more fields to monitor
- (Optional) Add a Condition
- Click Confirm
Use Case: Record a new row whenever the product code changes.
Trigger Type 4: Alarm Trigger
Record data when an alarm activates.
Configuration Steps:
- Click Trigger Configuration
- Click Add → Alarm Trigger
- Select one or more alarm points
- Set Repeat Frequency: Continue recording while alarm is active
- Click Confirm
Use Case: Create a "fault snapshot" by recording key parameters every 5 seconds while an alarm is active.
Trigger Type 5: Tag Value Change Trigger
Record data when specific tags change value.
Configuration Steps:
- Click Trigger Configuration
- Click Add → Tag Value Change Trigger
- Select one or more tags to monitor
- Click Confirm
Use Case: Record data whenever equipment status changes (Running → Stopped → Fault).
Using Calculation Formulas
Calculation formulas process raw data to create meaningful metrics.
Formula Syntax
| Element | Description | Example |
|---|---|---|
| Field Reference | Reference another field | [Temperature], [Cycle_Time] |
| Operator | Mathematical or logical operator | +, -, *, /, >, <, == |
| Function | Built-in function | SUM(), IF(), TEXT() |
| Constant | Fixed value | 100, "OK", TRUE |
Common Operators
| Operator | Description | Example |
|---|---|---|
+ | Addition | [A] + [B] |
- | Subtraction | [End_Time] - [Start_Time] |
* | Multiplication | [Quantity] * [Unit_Price] |
/ | Division | [Good_Parts] / [Total_Parts] |
> | Greater than | [Temperature] > 80 |
== | Equal to | [Status] == "Running" |
&& | Logical AND | [Temp] > 80 && [Pressure] > 50 |
|| | Logical OR | [Alarm1] == 1 || [Alarm2] == 1 |
Commonly Used Functions
Logical Functions
| Function | Syntax | Example |
|---|---|---|
| IF | IF(condition, true_value, false_value) | IF([Score] > 60, "Pass", "Fail") |
| AND | AND(expr1, expr2, ...) | AND([Temp] > 80, [Pressure] > 50) |
| OR | OR(expr1, expr2, ...) | OR([Status] == "Fault", [Status] == "Error") |
Numeric Functions
| Function | Syntax | Example |
|---|---|---|
| SUM | SUM(val1, val2, ...) | SUM(10, 20, 30) = 60 |
| AVERAGE | AVERAGE(val1, val2, ...) | AVERAGE(10, 20, 30) = 20 |
| ROUND | ROUND(number, digits) | ROUND(3.14159, 2) = 3.14 |
| ABS | ABS(number) | ABS(-5) = 5 |
Text Functions
| Function | Syntax | Example |
|---|---|---|
| CONCATENATE | CONCATENATE(str1, str2, ...) | CONCATENATE("Line", "1") = "Line1" |
| TEXT | TEXT(value, format) | TEXT(TODAY(), "yyyy-MM-dd") = "2024-01-15" |
| UPPER | UPPER(text) | UPPER("abcd") = "ABCD" |
| LOWER | LOWER(text) | LOWER("ABCD") = "abcd" |
Date Functions
| Function | Syntax | Example |
|---|---|---|
| TODAY | TODAY() | Current date |
| NOW | NOW() | Current date and time |
| YEAR | YEAR(date) | YEAR("2024-01-15") = 2024 |
| MONTH | MONTH(date) | MONTH("2024-01-15") = 1 |
| DAY | DAY(date) | DAY("2024-01-15") = 15 |
| HOUR | HOUR(time) | HOUR("14:30:00") = 14 |
Special Functions
| Function | Syntax | Description |
|---|---|---|
| PREVALUE | PREVALUE(field) | Get previous record value |
| CHANGE | CHANGE(field, range) | Calculate change from previous value |
Formula Examples
Calculate Yield:
[Good_Parts] / [Total_Parts] * 100
Calculate OEE:
([Availability] * [Performance] * [Quality]) / 10000
Determine Shift:
IF(HOUR([Record_Time]) < 14, "Day Shift", "Night Shift")
Calculate Duration in Minutes:
DATEDIF([Start_Time], [End_Time], "M")
Format Date:
TEXT([Record_Time], "yyyy-MM-dd HH:mm:ss")
Calculate Energy Cost:
[Energy_Consumption] * [Unit_Price]
Detect Counter Reset:
IF([Current_Count] < PREVALUE([Current_Count]),
[Current_Count] + 10000,
[Current_Count] - PREVALUE([Current_Count]))
Calculate Net Production:
CHANGE([Cumulative_Count], 10000)
💡 Tip: Click Validate in the formula editor to check for syntax errors before saving.
Best Practices
Trigger Configuration
Choose the Right Trigger:
- Use Tag Trigger for event-based recording (part complete, alarm)
- Use Scheduled Trigger for periodic sampling (temperature, pressure)
- Use Field Change Trigger for status tracking (product code change)
- Combine multiple triggers for comprehensive data capture
Avoid Over-Triggering:
- Don't record data more frequently than needed
- Use aggregation tables instead of high-frequency raw data
- Consider storage and performance impact
Formula Best Practices
Keep Formulas Simple:
- Break complex calculations into multiple fields
- Avoid nested formulas (> 3 levels deep)
- Document formula logic in field descriptions
Error Handling:
- Handle division by zero:
IF([Total] == 0, 0, [Good] / [Total]) - Check for null values:
IF([Field] == NULL, 0, [Field]) - Validate data types match formula expectations
Performance:
- Use aggregation instead of complex formulas when possible
- Test formulas with sample data before deployment
- Monitor system resources during peak archiving periods
Next Steps
- Data Management Reference - Complete function library
- Data Management Examples - Real-world scenarios
- Creating Data Tables - Back to table creation