Dear community,
Here is my scenario:
I have a list of measures used in one or multiple FMEA tables. In order to find them, I would like to introduce a new property, filtering over the data and printing out (once) the worksheet where the measure is used.
My code snippet looks like:
//find all measure entries
var allEntries = finder.findByType(Metamodel.FMEA.MeasureEntry).asArray();
var result= [];
// go through all measure entries
for (var i = 0; i < allEntries.length; i++) {
var measureGroup= allEntries[i].element;
//if the measure is part of the detection or the prevention columnts
if (measureGroup.detectionMeasures.contains(self)||measureGroup.preventionMeasures.contains(self)){
console.log("found" + self);
//navigate to get the name of the worksheet
var sheet = allEntries[i].failureCause.failureMode.component.worksheet;
// if the sheet is not in the existing results of FMEA sheets, add it, otherwise skipp it
if (!result.includes(sheet)){
result.push(sheet);
}
}
}
result;
The check if (!result.includes(sheet)){ does not work, since 'result' is recognized as NativeArray. Any idea why?
Thank you in advance and kind regards,
Krassi