cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Unable to store and retrieve location in a data table

DuanGauche
11-Garnet

Unable to store and retrieve location in a data table

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 1
slangley
23-Emerald II
(To:DuanGauche)

Hi @DuanGauche.

 

Thank you for sharing your insights with the community!

 

Regards.

 

--Sharon

Top Tags