Please provide edit validate rule logic for below:-
REPLACE(Replace(B.DatabaseName,‘[’,‘’),‘]’,‘’)
Please provide edit validate rule logic for below:-
REPLACE(Replace(B.DatabaseName,‘[’,‘’),‘]’,‘’)
@angady74 You don’t need two REPLACE calls in the edit validate; you can do it in one using replaceAll. In the Java code of your Edit Validate rule, take the input string (for example String db = aValue;). Then call db = db.replaceAll("[\\[\\]]", "");. This regular expression [\\[\\]] means “match either [ or ]”. Because [ and ] are special characters in regex, you escape them with backslashes. The replaceAll then removes every [ and ] from the string. So the final result is effectively the same as REPLACE(Replace(B.DatabaseName,'[',''),']',''). After this, you can either return true if the cleaned value is valid or compare it as needed for your validation logic.
Would you please provide me the entire logic here ?
if (aValue == null || aValue.trim().isEmpty()) {
return true;
}
// Remove [ and ] from the value
String cleaned = aValue.replaceAll(“[\[\]]”, “”);
// Set back to the property
aProperty.setValue(cleaned);
return true;