bool checkStyle = false; bool checkColor = attribute.Selection.GetStringValue() == "Wood"; ConfigAttribute width = null; if (!checkColor) return ""; // No need to continue foreach (ConfigAttribute attr in config.Attributes) { if (checkStyle && checkColor && width != null) break; if (attr.val_Name == "Width") { width = attr; } else if (attr.val_Name == "Style") { // Check the style if (attr.Selection.GetStringValue() == "Modern") checkStyle = true; else return ""; // No need to continue } } if (checkStyle && checkColor) { // Clear the selection if less than 20 if (width.Selection.HasValue && width.Selection.GetNumericalValue() < 20) width.Selection.Set(null, false); } return "";