Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if text field is all alphas or all numeric 3

Status
Not open for further replies.

misbrandy

MIS
Jun 12, 2007
41
US
I think I've seen this out there, but cannot find it....

How can I check to check if the contents of a text field contain all alphas, all digits, or a mixture?

Using CR10; crystal or basic syntax.
 
misBrandy,

The result of this function:

NumericText({table.Field})

will return True if all numeric.

Andy
 
Create a formula:

stringvar x := {table.field};
numbervar cnt := 0;
numbervar i := 0;
stringvar y := "";

for i := 1 to len(x) do(
if not isnumeric(x) then
cnt := cnt + 1
);
if len(x) = 0 then
y := "Blank" else
if numerictext(x) then
y := "Numeric Only" else
if cnt := len(x) then
y := "Alpha Only" else
y := "Mixed Alpha and Numeric";
y

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top