Thanks for pointing out that you already posted the domains of the fields. You are also right about the topology. There is another type of attribute rule (validation rule) that will participate in topology, but I think it hasn't been implemented yet.
Looking at the domains, there is an error in the expression regarding reading the description. See the code below:
function IsValidMaterial(material, valid_materials) {
var valid = False;
for (var i = 0; i < Count(valid_materials); i++) {
if (material == valid_materials[i]) {
valid = True;
}
}
return valid;
}
var diameter = DomainName($feature, 'DIAMETER');
var material = $feature.MATERIAL;
var validation = False;
if ((diameter == '24"') || (diameter == '30"') || (diameter == '36"') || (diameter == '48"')) {
var allowed_materials = ["CI", "SP"];
return IsValidMaterial(material, allowed_materials);
} else if ((diameter == '18"') || (diameter == '20"')) {
var allowed_materials = ["DI"];
return IsValidMaterial(material, allowed_materials);
} else {
return True;
}
... or perhaps better, just using the domain codes:
function IsValidMaterial(material, valid_materials) {
var valid = False;
for (var i = 0; i < Count(valid_materials); i++) {
if (material == valid_materials[i]) {
valid = True;
}
}
return valid;
}
var diameter = $feature.DIAMETER;
var material = $feature.MATERIAL;
var validation = False;
if ((diameter == 24) || (diameter == 30) || (diameter == 36) || (diameter == 48)) {
var allowed_materials = ["CI", "SP"];
return IsValidMaterial(material, allowed_materials);
} else if ((diameter == 18) || (diameter == 20)) {
var allowed_materials = ["DI"];
return IsValidMaterial(material, allowed_materials);
} else {
return True;
}
To validate what is happening you could use the expression in a pop-up and see what is returned and add some Console statements for debugging.