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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

how to change data change type against a particular property through a service

asekar
13-Aquamarine

how to change data change type against a particular property through a service

how to change "data change type" value against a particular property through a service

1 REPLY 1
amittal-3
13-Aquamarine
(To:asekar)

Hello,

I guess there is no possibility of changing the type of the property at runtime using service. But what I can propose is, write a custom service where - 

STEP 1: Get the attributes (name, base type, description, logged, persistence, read-only etc.) of your property using the generic service 'GetPropertyDefinition' and store them locally in the service.

STEP 2: Delete the property for which you need to change the data (base) type using another generic service 'RemovePropertyDefinition'

STEP 3: Create another property, using the attributes we saved in STEP 1, keeping everything same and just changing the data (base) type. To do so you can use a generic service 'AddPropertyDefinition'. Possibly use try-catch when creating the property. Restart the thing, its a mandatory step, at the end. This will add the property to your thing dynamically.

I hope it helps. But I am wondering why would you want to do so, because in programming we don't change the data type of the variable at run time. If there is a possibility to use the type-casting feature, I would suggest, try to evaluate and use that.

Thanks

Aditya

Top Tags