Modify SQL queries in the config to extract the data.
Tananaev ,can you pleas help me
this my QUERY wich i want to extract distance and totalDistance from attributes colomun
<entry key='database.insertPosition'>
START TRANSACTION;
INSERT INTO tc_positions (protocol, deviceid, servertime, devicetime, fixtime, valid, latitude, longitude, altitude, speed, course, address, attributes, accuracy, network)
VALUES (:protocol, :deviceid, :servertime, :devicetime, :fixtime, :valid, :latitude, :longitude, :altitude, :speed, :course, :address, :attributes, :accuracy, :network);
SELECT @accountID := accountID, @objectID := isAttached FROM tc_devices WHERE id = :deviceid;
INSERT INTO eventdata (accountID, objectID, deviceID, timestamp, statusCode, latitude, longitude, speedKPH, heading, altitude, address, rawData, creationTime)
VALUES (@accountID, @objectID, :deviceid, UNIX_TIMESTAMP(:devicetime), 0, :latitude, :longitude, :speed*1.852, :course, :altitude, :address, :attributes, UNIX_TIMESTAMP(NOW()));
UPDATE object SET lastDataID = LAST_INSERT_ID(), lastValidLatitude = :latitude, lastValidLongitude = :longitude, lastValidspeedKPH = :speed*1.852, lastValidHeading = :course, lastGPSTimestamp = UNIX_TIMESTAMP(:devicetime), lastAddress = :address, lastUpdateTime = UNIX_TIMESTAMP(NOW()) WHERE objectID = @objectID;
COMMIT;
</entry>
Read database engine documentation and see if there's a way to extract JSON values. Here's a MySQL function that might help:
Thanks!! i do it
Hi
i use traccar 4.6 version
In positons table th field arributes has these values:
I would like to use each attribute alone to store it in another field of another tabl, when inserting a new position.
how i can separate them??