mvonhasselbach
10/11/2017 - 12:07 PM

Make Infotable entries unique based on specified attributes (only one entry with the same value pairs)

[Make Infotable entries unique based on specified attributes (only one entry with the same value pairs)] Unique webject capabilities (takes first match for a given distinct att) #Thingworx

//result is an empty IT from the correct DS
//task is an IT from the right DS
// result: INFOTABLE 
var umps = Resources["InfoTableFunctions"].Distinct({  
  t: tasks /* INFOTABLE */,  
  columns: 'MaintenancePlan,EquipmentTemplate' /* STRING */ 
});  
Array.prototype.forEach.call(umps.rows, function (row) {
  result.AddRow(tasks.Find(row)); 
});