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 Pro tier.

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).
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 units and/or an emoji icon to displayed data (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
OperatorDescriptionExample
+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=[message1] & [message2]
| Union of two signals =[signal1] | [signal2] 
== Equality (Exact Match) Operator=[message1] == "hello"
!= Inequality Operator=[message1] != "error"
~ Partial Match Operator=[message1] ~ "err"
< Less Than Operator=[temp_f] < 90
<=Less Than or Equal Operator=[temp_f] <= 70
> Greater Than Operator=[temp_f] > 0
>= Greater Than Or Equal Operator=[temp_f] >= 1
()Group =([temp_f]+2)/3
.Member Operator=math.max([temp_f], 32)
$ Use Selected Signal in Waves=$+2
Global Methods
MethodDescriptionExample
convertNumerical Unit Conversion =convert([temp_f], "f", "c")
smoothLine Graph Curve Smoothing =smooth([temp_f])
math.roundNumerical Rounding =math.round([temp_f], 2)
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.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

Feedback and Knowledge Base