Is there any api to find uncommon values present in two infotables.
Is there any api to find uncommon values present in two infotables.
Is there any api to find uncommon values present in two infotables.
Here's a significant improvement to the previous code. What is slow in my previous code is the "includes" part which does not perform well. What is fast is when you check the existence of indexes in an array instead of the value. But with your complex keys, we can't do that because the keys are not plain numbers. The alternative to array checking is to check for the existence of properties in an object. So we convert each key into an objects property and check against that. With this, the task can be done in few seconds, even with 2x200.000 items. Code goes like this:
} else if (PartsFromMasterBOM.length > 0 && PartsFromModelBOM.length > 0) {
//when ComparisonChanged==true
// create new empty infotables for result:
let newPartsFromModelBOM=DataShapes["PUT_HERE_CORRECT_DATASHAPE"].CreateValues();
let newPartsFromMasterBOM=DataShapes["PUT_HERE_CORRECT_DATASHAPE"].CreateValues();
let delMasterObject={};
let delModelObject={};
PartsFromMasterBOM.rows.toArray().filter(r=>r.ObjectType!="Modular Part")
.forEach(r=>delMasterObject["Pt"+(r.PARTNUMBER+"_"+(IncludeEnggSeqForComparison?r.ENGINEERINGSEQUENCE:"")+"_"+(IncludeQtyForComparison?r.QUANTITY:"")+"_"+(IncludeParentForComparison?r.PARENTITEMNUMBER:""))
]=true);
PartsFromModelBOM.rows.toArray().forEach(r=>{
let code="Pt"+r.PARTNUMBER+"_"+(IncludeEnggSeqForComparison?r.ENGINEERINGSEQUENCE:"")+"_"+(IncludeQtyForComparison?r.QUANTITY:"") +"_"+(IncludeParentForComparison?r.PARENTITEMNUMBER:"");
if (!delMasterObject[code])
newPartsFromModelBOM.AddRow(r);
else
delModelObject[code]=true;
});
PartsFromMasterBOM.rows.toArray().forEach(r=>{
if (!delModelObject["Pt"+r.PARTNUMBER+"_"+(IncludeEnggSeqForComparison?r.ENGINEERINGSEQUENCE:"")+"_"+(IncludeQtyForComparison?r.QUANTITY:"")+"_"+(IncludeParentForComparison?r.PARENTITEMNUMBER:"")])
newPartsFromMasterBOM.AddRow(r);});
result.AddRow({ UnCommonPartsInMasterBOM: newPartsFromModelBOM, UnCommonPartsInModelBOM: newPartsFromMasterBOM });
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.