Sensor readings
Create stunning reports for your industrial temperature sensors
- Template type document docx medium
- Carbone min. v4.24.0+
- Features bidirectional-loop color aggregator
- Target datasheet audit monitoring custom
Objectives
You want to generate a report with the following features:
- Display sensor measurement values over time using a horizontal loop.
- Display sensor measurement values across different locations using a vertical loop.
- Dynamically colorize cells based on the values.
Solution
Here’s how you can achieve this using Carbone:
Define your temperature scale and colors
Design a simple table to act as a legend, displaying values alongside their corresponding colors.
- Draw the array for data placement
- Write the headers for the array: the first row and the first column.
- Insert the expected values into the cells using Carbone tags.
- Note that each
[i+1]
must be repeated in the horizontal loop, while a single[i+1]
is sufficient to define the vertical loop.
Color the cells
Add a Carbone tag to set the color of the cell that:
- Uses the
:show()
formatter to conditionally determine the cell's colorization, - Uses the
color
formatter to set the background color, as shown in the following formula:
{d.town[i].data[i].temperature:ifGTE(-15):and:ifLT(-10):show(#0661FF) :or(.temperature):ifGTE(-10):and:ifLT(-5):show(#0395FF) :or(.temperature):ifGTE(-5):and:ifLT(0):show(#03CBFF) :or(.temperature):ifGTE(0):and:ifLT(5):show(#00FEFD) :or(.temperature):ifGTE(5):and:ifLT(10):show(#B3FFFD) :or(.temperature):ifGTE(10):and:ifLT(15):show(#FBFD35) :or(.temperature):ifGTE(15):and:ifLT(20) :show(#FFD800) :or(.temperature):ifGTE(20):and:ifLT(25):show(#FFB201) :or(.temperature):ifGTE(25):and:ifLT(30):show(#FC9203) :or(.temperature):ifGTE(30):show(#FF5F03):color(cell,background)}
Tip: Add spaces within the Carbone tag to improve formula readability and ensure better text wrapping within the cell.
- Uses the
Compute the Average
- Use the
:aggAvg
formatter to calculate the average of the set. - Use the
:round()
formatter to round the result.
For example:
{d.town[i].data[].temperature:aggAvg:round(2)}
- Use the
And there you go!
Trusted by 600+ paid customers in 40+ countries














