Thingworx provides a library of InfoTable functions, one of the most powerful ones being DeriveFields (besides that I use Aggregate and Query a lot and ... getRowCount)

DeriveFields can generate additional columns to your InfoTable and fill that with values that can be derived from ... nearly anything! Hard coded, based on a Service you call, based on a Property Value, based on other values within the InfoTable you are adding the column to.

Just remember for this Service (as well as Aggregate), no spaces between different column definitions and use a , (comma) as separator.

 

Here are some two powerful examples:

 

//Calling another function using DeriveFields

//Note that the value thingTemplate is the actual value in the row of column thingTemplate!

var params = {

  types: "STRING" /* STRING */,

  t: AllItems /* INFOTABLE */,

  columns: "BaseTemplate" /* STRING */,

    expressions: "Things['PTC.RemoteMonitoring.GeneralServices'].RetrieveBaseTemplate({ThingTemplateName:thingTemplate})" /* STRING */

};

 

// result: INFOTABLE

var AllItemsWithBase = Resources["InfoTableFunctions"].DeriveFields(params);

 

//Getting values from other Properties

//to in this case is the value of the row in the column to

//Note the use of , and no spaces

//NOTE: You can make this even more generic with something like Things[to][propName]

var params = {

    types: "NUMBER,STRING,STRING,LOCATION" /* STRING */,

    t: AllAssets /* INFOTABLE */,

    columns: "Status,StatusLabel,Description,AssetLocation" /* STRING */,

    expressions: "Things[to].Status,Things[to].StatusLabel,Things[to].description,Things[to].AssetLocation" /* STRING */

};

// result: INFOTABLE

var AllAssetsWithStatus = Resources["InfoTableFunctions"].DeriveFields(params);