How to replace certain text in report results
If you need to replace certain text in your report in a dynamic way, you can do so by using the math.eval function in the report.
To add this script to your report, you need to know how to make a copy of your report, and edit this copy in Site Admin > Reporting > Manage Reports > View (your report copy).
To edit or customize the report, you can read more here.
Replace
- $math.eval( {expression} ? {value if true} : {default value} )
where
: denotes 'OR' operator
? denotes 'then' operator
Example 1:
$math.eval([SOS] == 0 ? 'False' : 'True')
This expression will replace the result of the variable SOS signal, so 0 --> false. If the value is not equal to 0, it will add the default result 'True.'
Example 2
$math.eval([Ignition] == 1 ? 'On' : [Ignition] == 0 ? 'Off' : 'no signal' )
This expression will replace the result of the variable ignition, so 1 --> 'On' and 0 --> 'Off.' If none of these values are found, the default assignment will be 'no signal.'
Example 3
$math.eval([Distance] < 1000.0 ? 0 : $math.round([Distance]/[Speed],2) )
This expression will replace any value under 1000 with 0. Anything over 1000 will be rounded to 2 decimals.