Computed Attributes ignore non exist driverUniqueId

DoMiNiK2 months ago

I have a minor problem that I can't figure out how to ignore a non-existent driver, I have a teltonika device that uses iBeacon to list the driver on the parameters beacon1Uuid, beacon2Uuid, beacon3Uuid, .... etc

The problem is that if the driver does not exist, it only lists the ID, how to get it to list only the existing driver that is found in the parameters beacon1Uuid, beacon2Uuid, beacon3Uuid, .... etc

sometimes it is written in 1Uuid, sometimes in 2Uuid, etc

Anton Tananaev2 months ago

You should be able to use computed attributes to check which ones exist and which ones don't.

DoMiNiK2 months ago

I tried to create computed attributes, but this way I would have to add each new driver here, is there an option in computed attributes that sends a request to verify if the Driver's UID exists in traccar?

(beacon1Uuid == "UUID_DRIVER_1" || beacon2Uuid == "UUID_DRIVER_1" || beacon3Uuid == "UUID_DRIVER_1" || beacon4Uuid == "UUID_DRIVER_1") ? "UUID_DRIVER_1" :
(beacon1Uuid == "UUID_DRIVER_2" || beacon2Uuid == "UUID_DRIVER_2" || beacon3Uuid == "UUID_DRIVER_2" || beacon4Uuid == "UUID_DRIVER_2") ? "UUID_DRIVER_2" :
(beacon1Uuid == "UUID_DRIVER_3" || beacon2Uuid == "UUID_DRIVER_3" || beacon3Uuid == "UUID_DRIVER_3" || beacon4Uuid == "UUID_DRIVER_3") ? "UUID_DRIVER_3" :
(beacon1Uuid == "UUID_DRIVER_4" || beacon2Uuid == "UUID_DRIVER_4" || beacon3Uuid == "UUID_DRIVER_4" || beacon4Uuid == "UUID_DRIVER_4") ? "UUID_DRIVER_4" :
"Unknown Driver"

Or do computed attributes only work with position data? Isn't there a simpler option?

Anton Tananaev2 months ago

There's probably a simpler way to structure the expression to avoid duplication.