Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I have requirement to find unmatched rows from two tables.
Basically need to compare one table data to another table and save the unmatched records from first table into new table.
I used intersect to solve this.
but getting Unable To Convert From org.mozilla.javascript.UniqueTag to INFOTABLE error.
Some observations:
-If you assign the Infotables with the result of a service, there is no need to Create them previously.
-There is a more elegant way to create infotables than CreateInfoTableFromDataShape, e.g.:
let DWMWorkPackageData = DataShapes["DWM_DB_WorkPackage_DS"].CreateValues();
-as Jointype use "INNER" not "inner"
-Is there a typo in joinColumns1? ACITIVITY_ID instead of ACTIVITY_ID?
Hi thanks for the reply.
Actually typo error is solved but my doubt is if I use INNER join it is returing common rows. But my requirement is to get unmatched rows from table 1 and display it as result .
Is there is any other Join I can use
I was more focusing on the capitalisation of "inner" jointype than what the code does. There is no readymade "minus" operation. But if you want to something like that, you could go roughly with something like this:
//Get Accepted JobCards from EIDW database
let eIDWData = me.GetActivityVersionData({Status: Status});
//Get Project details from Application database
let dWMProjectData = Things["DWM_Database_AppDBThing"].GetProjectData({Status: Status});
let excludeList=[];
dWMProjectData.rows.toArray().forEach(row=>{
excludeList.push(row.PROJECTID);
});
result=DataShapes["DWM_ DB_EIDWACTIVITYVERSION_DS"].CreateValues();
eIDWData.rows.toArray().forEach(row=>{
if (excludeList.includes(row.ACTIVITY_ID))
result.AddRow(row);
});
This will return the matched rows not the unmatched rows.
just make the statement then
if (!excludeList.includes(row.ACTIVITY_ID))