Real-Time Expressions: Introduction


Real-time expressions allow you to instantly manipulate, transform, and filter data inside of data visualization apps such as Tiles and Waves. This allows you to make changes and calculations on your data without having to export your data to another application. Incoming data will be automatically transformed in real-time based on the input expression.

*Real-time expressions are available in the Personal and Pro tiers.

Use Cases


Filter out unwanted data (example).
Convert the units of a temperature stream from Celsius to Fahrenheit (example).
Compute energy costs from Watts logged (example).
Map values in a data stream to emojis (example).
Create a new data stream through a mathematical combination of two existing data streams (example).
Search for specific values inside a data stream in Waves (example).
Smooth out a noisy line graph (example).
Round the number of decimal places down to something more easily readable (example).
Combine separate latitude and longitude into a single location stream viewable in the map tile (example).
Merge two data streams into a single data stream (example).
Add static units and/or an emoji icon to displayed data (example).
Display "On" if Any Value is "On" (example).
Convert velocity and acceleration from a binary motor encoder signal (example).

Using Real-Time Expressions in Tiles


Real-time expressions are executed in Tiles by entering a legal expression in the signal key input field in the tile configuration. Pressing <enter> will update the preview tile with the input expression. Closing the tile configuration box will apply the expression in your Tiles dashboard.

Using Real-Time Expressions in Waves


Real-time expressions are executed in Waves by entering a legal expression in the input field toolbar at the top of Waves. Pressing <enter> will create a new signal based on the input expression. 

Syntax


Expressions are prefixed with the "=" character.

Signal Identifiers
Input signals are enclosed in [ ]. example: =[temp_f]*2

Number Literal
Numbers can be specified as integers (0 1234), hexadecimal integers (0xF 0x123F), binary integers (0b1 0b1011), decimals (0.21 123.456), and scientific notation (0e6 10e+5 0.1e-8).

String Literal
Strings are enclosed " ". example: 
=[message1] == "hello"

Escape Sequence
Special characters can be escaped using \ . example: =[signal\[0\]]*2
Unicode escape sequences: \u00 \x0000 \{#00000}


Multiple Inputs, Operators, and Methods in one Expression
Any number of input data streams, operators, and functions can be combined into a single expression. Data streams, operators, and functions can be repeated as many times as desired in a single expression.
example (computes dew point 
°F from temperature °F and relative humidity by converting to Celsius then back to Fahrenheit): 
=convert(convert([Temperature (F)],"F","C")-((100-[Relative Humidity])/5),"C","F")

Operators
Operator DescriptionExample
+ Add two numbers=[temp_f]+2
- Subtract two numbers=[temp_f]-3
* Multiply two numbers=[temp_f]*4
/ Divide two numbers=[temp_f]/5
- Negative of a number=-[temp_f]
% Modulo=[temp_f]%2
& Concatenate two strings (more info)=[message1] & [message2]
| Union of two signals (more info)=[signal1] | [signal2] 
== Equality (Exact Match) Operator (more info)=[message1] == "hello"
!= Inequality Operator (more info)=[message1] != "error"
~ Partial Match Operator (more info)=[message1] ~ "err"
!~ No Partial Match Operator (more info)=[message1] !~ "err"
< Less Than Operator (more info)=[temp_f] < 90
<= Less Than or Equal Operator (more info)=[temp_f] <= 70
> Greater Than Operator (more info)=[temp_f] > 0
>= Greater Than Or Equal Operator (more info)=[temp_f] >= 1
() Group =([temp_f]+2)/3
. Member Operator=math.max([temp_f], 32)
: Map Operator (more info)=([temp_f]>80):"hot"
$ Use Selected Signal in Waves (more info)=$+2
Global Methods
MethodDescriptionExample
convertNumerical Unit Conversion (more info) =convert([temp_f], "f", "c")
smoothLine Graph Curve Smoothing (more info) =smooth([temp_f])
math.roundNumerical Rounding (more info) =math.round([temp_f], 2)
math.sumCumulative sum (more info) =math.sum([data_stream])
math.meanCumulative average (more info) =math.mean([data_stream])
math.minTake the lesser of two numbers =math.min([temp_f], 100)
math.maxTake the greater of two numbers =math.max([temp_f], 32)
math.sqrtSquare root of a number =math.sqrt([data_stream])
math.sinSine of a number =math.sin([data_stream])
math.cosCosine of a number =math.cos([data_stream])
math.tanTangent of a number =math.tan([data_stream])
math.PIπ (constant) =math.PI
math.deltaChange in value (more info) =math.delta([data_stream])
math.timeDeltaChange in time (more info) =math.timeDelta([data_stream], "sec")
math.timeDerivativeTime derivative (more info) =math.timeDerivative([data_stream], "sec")

Feedback and Knowledge Base