Configuring Data Shapes
The dataShapes group is used to define Data Shapes that describe the structure of an infotable.
Data shapes that are declared can be used as input or output for services. In addition, you can use Data Shapes to generate strongly typed data structures.
Each Data Shape is defined using a series of tables, with each table representing a field within the Data Shape. These fields must have a name and base type, but may also include other parameters. For example:
dataShapes.MeterReading(
{ name = "Temp", baseType = "INTEGER" },
{ name = "Amps", baseType = "NUMBER" },
{ name = "Status", baseType = "STRING", aspects = {defaultValue="Unknown"} },
{ name = "Readout", baseType = "TEXT" },
{ name = "Location", baseType = "LOCATION" }
The following table describes these parameters:
Parameter
Description
dataShape.nameOfDataShape
Declares a Data Shape.
name
Required. Specify the name of a field in the Data Shape.
baseType
Required. Specify the EMS base type of the field in the Data Shape. For a list of base types, refer to ThingWorx Base Types.
description
Provides a description of the Data Shape.
ordinal
Specify the order.
aspects
Specify a table that can provide additional information, such as a default value, or a Data Shape if the base type of the field is INFOTABLE.
Was this helpful?