Skip to main content
12-Amethyst
July 26, 2023
Question

Unable to store and retrieve location in a data table

  • July 26, 2023
  • 1 reply
  • 942 views

TLDR: Don't use a field name called "location" in your DataTable to save values of the datatype location. Just call it something else.

 

I have been trying to store some data in a DataTable and run into an issue where whenever I try to retrieve the location field, it would always be 0,0,0.

 

This was very confusing and I was clearly not the only person, here is an old post with a false solution:

https://community.ptc.com/t5/ThingWorx-Developers/Unable-to-store-location-in-a-data-table/td-p/513471

 

The problem lies in the fact that when your datashape has a field definition called "location" of datatype location, then you are duplicating the internal field definition of a DataTable.

 

Below is a screenshot of the default field definitions and you will see that there is a "location" field in there.

Screenshot 2023-07-26 at 11.27.24.png

Just change your DataShape to use a different field name (other than "location") and you should be fine.

1 reply

Community Manager
August 1, 2023

Hi @DuanGauche_23281.

 

Thank you for sharing your insights with the community!

 

Regards.

 

--Sharon