QueryDataTableEntries is not working expectedly Thingworx 9.3.7
it has to match with the serial Number and return the entry where it matches the serial number but it returns all the entries of datatable. sometimes it works fine but again after sometime if i run the service again it shows me all the entries. it works fine until i give the serialnumber to get the entries and then when i add wrong serialnumber then it keeps showing me the old output with all the entries. I have never seen such a wrong behaviour before. Anyone can please help me in this regard
const SERVICENAME = "evaluateExistingSerialNumber";
logger.info(me.name +" :: "+ SERVICENAME +" :: Start Service");
//let result;
let maxEntriesToFilter = 40;
let latestEntriesInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName: "InfoTable",
dataShapeName: "ReUse.LatestEntries.DS"
});
let singleEntryInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
infoTableName: "InfoTable",
dataShapeName: "ReUse.LatestEntries.DS"
});
//try {
latestEntriesInfoTable = Things["ReUse." + lineName + "-" +Location +".DT"].QueryDataTableEntries({
maxItems: maxEntriesToFilter /* NUMBER */,
query: {
"type": "And",
"filters": [{
"type": "IN",
"fieldName": "serialNumber",
"values": [serialNumber]
},
],
}
});
//DEBUG STARTS
// For debugging (select OUTPUT as an infotable latestentriesDS- first 3 lines for latest entry and last line for all the entries)
//let resultRow = latestEntriesInfoTable.getRow(0);
//singleEntryInfoTable.AddRow(resultRow);
//let result = singleEntryInfoTable;
let result = latestEntriesInfoTable;

