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

How to pass list of property names for GetNamedProperties/GetNamedPropertiesWithValues?

sburton-3
3-Visitor

How to pass list of property names for GetNamedProperties/GetNamedPropertiesWithValues?

Can someone provide an example of using GetNamedProperties and GetNamedPropertyValues from Javascript? The first call takes a JSON object, and the second takes an INFOTABLE, but I haven't been able to find any documentation on what that JSON object or INFOTABLE should look like ...

Thanks !

1 ACCEPTED SOLUTION

Accepted Solutions
adam11
5-Regular Member
(To:sburton-3)

Hi Shaun,

The JSON object GetNamedProperties() takes as input (propertyNames) consists of a single JSON array (items):

var propertyNames = { "items": ["name", "stringProperty", "numberProperty"] }

var propertyValues = Things["ExampleThing"].GetNamedProperties({ propertyNames: propertyNames })

Similarly, GetNamedPropertyValues() is expecting an InfoTable with a DataShape of EntityList:

var propertyNames = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({ dataShapeName: "EntityList" })

propertyNames.AddRow({ name: "name" })

propertyNames.AddRow({ name: "stringProperty" })

propertyNames.AddRow({ name: "numberProperty" })

var propertyValues = Things["ExampleThing"].GetNamedPropertyValues({ propertyNames: propertyNames })

View solution in original post

2 REPLIES 2
adam11
5-Regular Member
(To:sburton-3)

Hi Shaun,

The JSON object GetNamedProperties() takes as input (propertyNames) consists of a single JSON array (items):

var propertyNames = { "items": ["name", "stringProperty", "numberProperty"] }

var propertyValues = Things["ExampleThing"].GetNamedProperties({ propertyNames: propertyNames })

Similarly, GetNamedPropertyValues() is expecting an InfoTable with a DataShape of EntityList:

var propertyNames = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({ dataShapeName: "EntityList" })

propertyNames.AddRow({ name: "name" })

propertyNames.AddRow({ name: "stringProperty" })

propertyNames.AddRow({ name: "numberProperty" })

var propertyValues = Things["ExampleThing"].GetNamedPropertyValues({ propertyNames: propertyNames })

View solution in original post

Thanks Adam - I will give this a try !!

Announcements