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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Updating Property Attributes Programmatically

Ascherer17
14-Alexandrite

Updating Property Attributes Programmatically

Is there any possible way to update a Thing's Property attributes (Read Only, Persistent, Base Type, Category, etc) via script?  I found the service 'SetPropertyLogging' for turning on/off data logging, but I can't find any similar service to take care of the other attributes.  

I want to be able to use a Service to update these aspects for many already-existing properties at once.

1 ACCEPTED SOLUTION

Accepted Solutions
posipova
20-Turquoise
(To:Ascherer17)

Currently not part of ThingWorx functionality https://www.ptc.com/en/support/article?n=CS281204

I'd try to work with REST calls. In your browser, open dev tools (f12 in chrome). When you update your property attributes manually, note the requests showing up in the Network tab. It should show the request and headers.

View solution in original post

4 REPLIES 4
posipova
20-Turquoise
(To:Ascherer17)

Try "AddPropertyDefinition".

 

me.AddPropertyDefinition({
defaultValue: undefined /* STRING */,
remoteBindingAspects: undefined /* JSON */,
description: undefined /* STRING */,
readOnly: undefined /* BOOLEAN */,
remote: undefined /* BOOLEAN */,
type: undefined /* BASETYPENAME */,
remotePropertyName: undefined /* STRING */,
timeout: undefined /* INTEGER */,
pushType: undefined /* STRING */,
dataChangeThreshold: undefined /* NUMBER */,
logged: undefined /* BOOLEAN */,
name: undefined /* STRING */,
pushThreshold: undefined /* NUMBER */,
dataChangeType: undefined /* STRING */,
category: undefined /* STRING */,
persistent: undefined /* BOOLEAN */,
dataShape: undefined /* DATASHAPENAME */
});

Ascherer17
14-Alexandrite
(To:posipova)

I did try this.  This service will throw an error because it's trying to create a property with a name that already exists.  I could delete my properties and recreate, but I'd like to avoid that scenario.

posipova
20-Turquoise
(To:Ascherer17)

Currently not part of ThingWorx functionality https://www.ptc.com/en/support/article?n=CS281204

I'd try to work with REST calls. In your browser, open dev tools (f12 in chrome). When you update your property attributes manually, note the requests showing up in the Network tab. It should show the request and headers.

slangley
23-Emerald II
(To:Ascherer17)

Hi @Ascherer17.

 

If the response provided by Constantine answered your question, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Top Tags