distance compute attribute

Primtek7 years ago

Hi,

I am trying compute attribute for distance, with criteria as below:

if motion = false or valid = false
then distance = 0
else
distance = distance * 1

does the syntax below is correct?

!motion || !valid? 0:distance*1

does it also impact to totalDistance? .. I meant.. the totalDistance should also added to the result value of compute attribute..

I only found compute attribute reference on:

https://www.traccar.org/documentation/computed-attributes/

where can I find complete reference for it?

thanks

Anton Tananaev7 years ago

Expression seems valid, but your result won't be added to the total distance because it's calculated earlier.

Primtek7 years ago

So the totaldistance wont to be adjusted because it’s calculated first.
Then the logic would be:

!motion || !valid ?totaldistance=totaldistance+0

does it support without the ‘:’ (else) part?

Thanks

for the totalDistance attribute:

!motion || !valid ? totaldistance+0

Anton Tananaev7 years ago

You always need else part.

Primtek7 years ago

so it would be

!motion || !valid ? totaldistance+0: totaldistance+distance

Cmiiw

all previous records would not be adjusted?
or is there anyway to adjust them?

Thanks

Anton Tananaev7 years ago

There is no way to adjust old records.

Primtek7 years ago

Noted & thanks

Primtek7 years ago

Is there any option in server to apply these compute attributes to all devices rather than to apply it to one by one device?

Anton Tananaev7 years ago

You can apply to a group.