Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
hello
i am recording location of devices into a value stream
all other data are well recorded and I'm able to retriev except one , the GPS position , type "Location"
the real time location (last one) is well displayed but not the history despite I have activated the "logged" option :
real time :
history :
Any reason not to have the Location recorded with other properties ?
Thanks
Handled via TS case C13893505.
Solution applied : How to set value for "Location" property by script in ThingWorx
I tried the method to update all properties in one time but the location is still not recorded with the other properties
var mylocation = new Object();
mylocation.latitude = parseFloat(position.latitude);
mylocation.longitude= parseFloat(position.longitude);
mylocation.elevation= parseFloat(position.altitude);
logger.debug( logprefix + JSON.stringify(mylocation));
var newField = new Object();
newField.name = 'LastPosition';
newField.baseType = 'LOCATION';
myUpdate.AddField(newField);
myUpdate.AddRow({LastPosition:mylocation});
var params = {
values: myUpdate /* INFOTABLE */
};
// Finally, update my thing with the properties in the table
Things[mything].UpdatePropertyValues(params);
the log for the new location :
M2TrackGetData:M2trackMonitoring:{"latitude":48.91365,"longitude":2.2523333333333335,"elevation":0}
the new location is not recorded (updated) :
If I use
Things[mything].LastPosition = mylocation;
it works but I got a separate record in the value stream.