Skip to main content
Jun 26, 2021 5:15 AM UTC
Question

Create infotable from Datashape doesn't work with Primary key. (Thingworx 9.1.0)

Hi,

when i create infotable from datashape with Primary key it is accepting duplicate key. below are some snaps..please suggest the correct solution. i want to store entries with primary key. when i enter duplicate key it should update automatically as datashape contains  a Field (Primary key ).

 

VaibhavShinde_0-1624684485628.png

Thanks,

5 replies

Jun 28, 2021 12:03 AM UTC

Hi,

 

This works to specification that infotables does not honor primary key.

You can use datatables (under data storage section) to store records with unique primary key (specified by datashape).

If you use predefined "AddDataTableEntry" service adding a record with duplicate key, a warning with "Entry With This Key Already Exists" will appear as the output; if you use "AddOrUpdateDataTableEntry" service to add a record to the datatable, it the key already exists, the data will be updated/overwritten with the new entry.

 

Best,

Tony

Aug 2, 2021 5:40 AM UTC

Hi @VaibhavShinde,

 

Did my reply answer your question? If so, could you please designate my reply as the Accepted Solution?

 

Thanks,

Tony

Aug 4, 2021 10:25 AM UTC

Hi @TonyZhang ,

Thanks for reply ,  as you said Datatable can use but I can't create datatable as a Property.

 

Thanks