Why? ThingworxInfoTableAdapter cannot be cast to com.thingworx.types.InfoTable
Here is quick outline of my service. When I run this inside of Thinkworx as a service, I get 4 data rows. Perfect. So now I want to return json and below are my attempts (logged). Any ideas on why this error occurs? I have tried every json-converter function I can find.
var DetailedLogging = true;
logger.warn("here is my input value....." + lastDTSCheck);
try {
var devices = Things['ATS.Org'].ListDevices();
var device;
var result = null;
result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName : "InfoTable",
dataShapeName : "OrgDateCheck"
});
var cnt = 0;
for each(device in devices.rows) {
device = Things[device.EntityName];
if (device.GetLastModifiedDate() > lastDTSCheck) {
cnt = cnt + 1;
logger.warn("My counter is now at: " + cnt);
if (result == null) {
result = Things[device.name].GetPropertyValues();
result.name = device.name;
} else {
result.AddRow(Things[device.name].GetPropertyValues().rows[0]);
result.rows[result.getRowCount() - 1].name = device.name;
}
}
}
//logger.warn("debugging the output? ..... " + result);
//logger.warn("debugging the output 2 as json string" + result.ToJSON() );
//logger.warn("debugging the output 3 as stringify: " + JSON.stringify(result) );
//logger.warn("debugging the output 4 as toString: " + result.toString() );
//result = JSON.stringify(result);
result.ToJSON();
} catch (err) {
logger.warn(me.name + ".MEB() [err]: " + err + ", " + err.lineNumber);
}

