Skip to main content
1-Visitor
September 1, 2015
Solved

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

  • September 1, 2015
  • 1 reply
  • 3179 views

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 !

Best answer by adamtrainer

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 })

1 reply

5-Regular Member
September 4, 2015

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 })

sburton-31-VisitorAuthor
1-Visitor
September 4, 2015

Thanks Adam - I will give this a try !!