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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Edit baseType and description on properties.

fserre
1-Newbie

Edit baseType and description on properties.

Hi All,

Is there any way to create a local service that can edit thing properties like description and baseType?

I have tried :

Things[myThing][myProperty].description = newDesc;

It was worth a try but that doesn't work...

6 REPLIES 6

Hi Fabien,

Very close try just to it like this:

Things[myThing].description = newDesc;

and it should work

Hi Amir,

Thanks for your answer.

But reading your anwser, I realized that I wasn't very clear in my request. I'd like to modify the properties of a thing's property. So, in my example, it is the description of myProperty that I'd like to edit.

i see,

try this

Things[(Things[mything].myproperty)].description = newDesc;

Hi Fabien,

This is metadata and you need design time permissions to do it, you should look at this type of services, Things[mything] [propertyName] --> This is Runtime

Carles.

tcoufal
12-Amethyst
(To:CarlesColl)

Hi Carles,

could you extend your answer? How this could be done than?

amittal-3
13-Aquamarine
(To:fserre)

Hello,

I didn't exactly did what you are required to do, but in my case I was only required to read the 'description' of property of a thing. I did by writing a script - 

********************************************************

var params = {
name: myProperty /* STRING */
};

result = Things[myThing].GetPropertyDefinition(params).description

**************************************************************

In this case if you check the output of result, its a string, displaying the text in description field.

 

I can suggest you to try the following (I am not sure if it would work or not)

Similar to "GetPropertyDefinition", I didn't find "SetPropertyDefinition", however there is a service, "AddPropertyDefinition" which allows you to create new property with all the new parameters as you wish, which means you can give your own description too. But there is a catch it, doesn't allow you to change the definition of any existing property, so probably you have to -

Step 1 -  copy entire definition of your property for which you need to change the description (in this case, myProperty), using "GetPropertyDefinition" service

Step 2 - remove the existing property (myProperty), using "RemovePropertyDefinition" service

Step 3 - create a new property with same defination as previous, just changing to your new description using, "AddPropertyDefinition" service.

 

-Thanks

Top Tags