Detail Table - Hide Parent - Strange Problem

I have a strange problem whereby I have a detail table that I am conditionally hiding entire rows if they meet a certain criteria

I have 2 rows almost identical, one conditional statement works correctly, the other always hides the row even though criteria doesn’t match…See below code

Working conditional statement (hides the entire row if code = 092)

results.each(function(index) {
var field, result = 0;

for(let i=0;i<record.tables.detail2.length;i++){

field = record.tables.detail2[i].fields["Code"];
if(["092"].indexOf(field) > -1) {
	result += record.tables["detail2"][i].fields["ANoPostP"];
}

}

results.html(formatter.currency(result));

// Hide the parent (row)
if( field !== "092") {
	this.parent().hide();
}

});

The below conditional statement always hides the row for some reason (should only hide the entire row if code does not = 091)

results.each(function(index) {
var field, result = 0;

for(let i=0;i<record.tables.detail2.length;i++){

field = record.tables.detail2[i].fields["Code"];
if(["091"].indexOf(field) > -1) {
	result += record.tables["detail2"][i].fields["ANoPostP"];
}

}

results.html(formatter.currency(result));

// Hide the parent (row)
if( field !== "091") {
	this.parent().hide();
}

});

They are exactly the same except that the 1st (working) code is checking for “092” and the second (non-working) code is checking for “091”

What am I missing?

If both script are “exactly” the same but for the code, logic points to an external guilty part.

To help you properly we would need to see the Template and reproduce the issue. I suggest you open a technical support ticket through our website.