Hello,
I am getting speed and ignition in postion attributes and through computed attributes i want to get device_status
- Running when speed>3 and ignition=true
- Idle when speed<3 and ignition = true
- stopped when speed<3 and ignition = false
- No Data when no above condition match
Now i know computed attributes expression are written in JEXL and i am no expert in the same but still i have tried and it was not working
attributes = device_status
Expression = speed > 3 && ignition==true? Running:speed<3&&ignition==true?Idle:speed<3 && ignition ==false:Stopped:NO_DATA
type= string
this is the error which is showing
org.traccar.handler.ComputedAttributesHandler.computeAttribute:119@1:94 parsing error in ':' - Parsing (ComputedAttributesHandler:119 < AttributeResource:63 < ...)
I was not able to find learning resource on JEXL so if anyone knows JEXL or know how to solve this, then please help
You can try nesting the conditions:
ignition ? speed > 3 ? Running : Idle : speed < 3 ? Stopped : No Data
Hello,
I am getting speed and ignition in postion attributes and through computed attributes i want to get device_status
Now i know computed attributes expression are written in JEXL and i am no expert in the same but still i have tried and it was not working
attributes =
device_status
Expression =
speed > 3 && ignition==true? Running:speed<3&&ignition==true?Idle:speed<3 && ignition ==false:Stopped:NO_DATA
type=
string
this is the error which is showing
I was not able to find learning resource on JEXL so if anyone knows JEXL or know how to solve this, then please help