
OpenNTF Code Bin
About This Code
Brief Description:
@DoWhile formula to check string data
Last Modified:
09 Apr 2007
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
If you are new to use @DoWhile() function of R7, this example may be helpful!
This formula codes will check for non-numeric e-mail address input through a click button.
Usage / Example
[NewShort] is the input e-mail address. Click the button to check if the left side of '@' are all numeric data and set the [ChkMail] and [ChkOK] data fields.
Button [Check E-Mail]:
xxx:=@LeftBack(NewShort;"@");
xx:=xxx;
n:=0;
IsNum:="Y";
nnList:="0":"1":"2":"3":"4":"5":"6":"7":"8":"9";
@DoWhile(
x:=@Left(xx;1);
xx:=@Right(xx;@Length(xx)-1);
y:=@IsMember(x; nnList);
@If(y=0; IsNum:="N" ;"");
n := n + 1;
n < @Length(xxx)
);
@If(IsNum="Y";@SetField("ChkMail";"Can not use number")+@SetField("ChkOK";"No")+@Return(@Success);
"");
ServerName := @Name([Abbreviate]; @Subset(@DbName; 1));
sn:=@DbLookup(""; ServerName : "Names.nsf"; "ByInternetAddress"; NewShort; "InternetAddress");
cn:=@DbLookup(""; ServerName : "Names.nsf"; "ByInternetAddress"; NewShort; "CName");
FIELD ChkOK:=@If(@IsError(sn)|sn="";"Yes"; "No");
FIELD ChkMail:=@If(@IsError(sn)|sn="";"(no)":"Nobody uses this E-Mail Address";sn:cn);
FIELD ChkMail0:=IsNum;
@Success
Comments
No documents found