ThingWorx Model Definition in Composer > Modeling > Things > Thing Services > Iterating Through a Thing's Properties
Iterating Through a Thing's Properties
You can easily iterate through a Thing's properties and examine the properties using the following technique:
// GetPropertyValues(): returns an INFOTABLE

var values = me.GetPropertyValues();var field;

// Now we can iterate through the INFOTABLE FIELDS through the DataShape

for each(field in values.dataShape.fields) {

var propValue = values[field.name];

if(field.baseType == "NUMBER") logger.warn(field.name + " " + field.baseType + " " + propValue);

}
You can even access the aspects of an individual field. For example, when you create a property, there are additional aspects of the property that you can define. Use the following technique/pattern to examine the property's aspects:
field.aspects(isPersistent)
field.aspects(minimumValue)
Was this helpful?