Tutorial for the Edge SDKs > Getting to Know Infotables
  
Getting to Know Infotables
The infotable is an often used and sometimes misunderstood data structure in the ThingWorx platform. Since many service calls use infotables as input parameters and as output return values it is hard to avoid them Once you understand them, you may even want to use them in your own Things.
What is an Infotable?
Infotables can be represented in any programming language. They provide a simple way to communicate their structure to users. The ThingWorx Edge SDKs all support the use of infotables. On ThingWorx platform, infotables are commonly used in JavaaScript implementations. An infotable is a zero-indexed, ordered array of objects that expose the same properties.
Since an infotable is an array of objects, it can also be thought of as a spreadsheet where the array entries are rows and the object properties of each object in the array are the columns. Since we are trying to represent tabular data, it is important that each object have the same properties so that each column of the table can map to a property value.
How Do Arrays Work in JavaScript?
If you have ever worked with an Array object in JavaScript, you are familiar with how arrays work in ThingWorx. For those who may want a refresher or have not worked with an Array object in JavaScript, let's go over the basics.
To declare an array, you can use the following:

var myArray=new Array();
var mySecondArray=[];
Both of the above statements are equivalent. They both create array objects. An array can contain multiple objects in sequence of any type. For example:
var myArrayOfStuff=[“Pickel”,3,{name:”Bill”,phone:”555-1212”}];
The above array contains a String, a number and a custom object with the fields name and phone. If you want to try this out for yourself, use the Chrome browser and open the JavaScript Console (CTRL+SHIFT+J). Then paste in the line above to create this array, and try the following examples to access the items in the array. Below is screen shot of the JavaScript console in Chrome showing how to create and the access each of the objects in the JavaScript array.
The "undefined" value is not an error on line 2 above. The declaration of a local scope variable (var) returned the object undefined as a result, but it does create the variable.
How is an Infotable Different from an Array?
In the example above, the JavaScript array contains completely different types of objects. Infotables can contain only one type of object. This type is defined, not with JavaScript's native object typeing mechanism, but through the use of another ThingWorx-specific typing definition, called a data shape. JavaScript considers every type of object that is stored in an infotable to be of type “Object” as you can see above when the command myArrayOfStuff[2] is printed out. Infotables require that each object in the array expose the exact same properties.
What is a Data Shape?
A data shape is a specification of the required property names and return types that each property of an "object" must have to be added to an infotable. Data shapes also contain other metadata about a property that is useful for formatting and displaying the infotable in a tabular format or Grid. You can declare data shapes in your Edge SDK application and in ThingWorx Composer. Data shapes are required to build a functional infotable. Essentially, ,they are a schema mechanism for defining the required fields of a thing in ThingWorx.