Array

Model attributes can be defined as arrays using the attribute modifier Cardinality.

Arrays are defined using Cardinality= "0..m" ("MinValue..MaxValue"), where MinValue >=0 and MaxValue is any integer m > 0.

cardinality =  "0..m" means that the max index for the array is 127, and the size 128. This is the default size for a 1 byte maximum value.

cardinality =  "0..1000" means that the max index for the array is 32767, and the size 32768. The capacity will always be rounded up to the next byte in terms of bit representation, e.g. 1000 will allocate 2 byes and therefore allow order to go as high as 32767 (0x7FFFF).


No Automatic Purging of Deleted Entires

There is no automatic purging of deleted entires i.e all order numbers are monotonic. For example, if you keep adding values to the end and delete values from beginning then you’ll always run out of numbers eventually. You’d need to employ some [better] enumeration scheme in this case, e.g. [periodically] renumber your values from 0.


DataModel attribute with Array
#
Def(Name: "PostalAddress"): 
 String(Name: "Street") 
 String(Name: "City") 
 String(Name: "Zipcode") 
  
DataModel(Name: "VendorInfo"):
  Sid(Name: "VendorSysId") 
  String(Name: "vendorName") 
  String(Name: "vendorTitle") 
  PostalAddress(Name: "VendorAddress") 
  String(Name: "DeviceTypes", Cardinality: "0..m")

When instatiating a model with array as attribue(s), the array can be simply given as a list of values.

Instantiate DataModel with an array attribute

Create DataModel attribute with Array
#
Query: 
  Create: 
    VendorIn:   
      vendorName: Phidget
      vendorTitle: "Sensor Provider"
      vendorAddress: 
        Street: "123 TQL Way"
        City: Sunnyvale
        Zipcode: 91234
      DeviceTypes: Sensors
      DeviceTypes: Actuators