Input Validation formula not validating correctly

On a form, I have an editable dialog list field that allows multiple values and retrieves values by a lookup to a view. The field works fine. However, on that field, I have an input validation formula where it searches a 2nd view for servers that are cities.

In the 2nd view, the first column is a list of servers sorted in ascending order and the second column displays either ‘Yes’ or ‘No’ depending on if the server is a city or not.

The lookup in the validation formula works fine. However, I can not get the field to validate correctly. Below is the full input validation formula. I hoping that someone with “fresh” eyes may see the problem. Any help is appreciated!

REM {Get the values from both columns in the Servers view};

serverColumn := @DbColumn(“”:“No Cache”; @DbName; “Servers”; 1);

cityColumn := @DbColumn(“”:“No Cache”; @DbName; “Servers”; 2);

REM {Look for Servers that has Yes in the cityColumn};

rsgCitiesLookup := “”;

@For(i := 1; i <= @Elements(cityColumn); i := i + 1;

server := @If(cityColumn[i] = “Yes”; serverColumn[i]; “”);

rsgCitiesLookup := @Unique(@Trim(rsgCitiesLookup:server)));

@If(Server = “Corporate” & Group = “”; @Failure(“If the Server contains ‘Corporate’, the Corporate Security Group is required.”); Server != “Corporate” & Group != “”; @Failure( “If the Corporate Security Group is filled in, the server name must contain ‘Corporate’.”); Server *= rsgCitiesLookup & RegionalSecurityGroup = “”; @Failure("If the Server contains one of " + @Implode(rsgCitiesLookup; ", ") + “, the Regional Security Group is required.”); RegionalSecurityGroup != “” & Server *!= rsgCitiesLookup;

@Failure("If the Regional Security Group is filled in, the server name must contain one of: " + @Implode(rsgCitiesLookup; ", ") + “.”); @Success)

Subject: RE: Input Validation formula not validating correctly

I think the fact that you are setting a temporary variable called server and there is also a field with the same name, whose value you are later trying to use, is a major part of the problem. Try this:

rsgCitiesLookup := @Unique(@Trim(@Left(citycolumn + “@” + servercolumn; “Yes@”)));