I'm curious - has @IsNumber EVER worked?

I was going nuts trying to get @IsNumber(…) to work in an Input Translation, so I started poking around and found the same issue going back many years. Has it ever worked as expected? Everywhere I read said to forget about using it and just use @IsError(@TextToNumber(…)) instead to check for the opposite outcome. I did so and that worked. It got me curious why this has existed for so long. Thanks.

Subject: Curious too - What’s the problem?

Not knowing what exactly you are trying to do, all I can say is that I’ve successfully been using @IsNumber for years in Input Translation and Validation formulas of Number fields. The only issue I can remember was related to older (pre 5) versions of Notes, where @IsNumber used to return @True with errors as argument. Just made a quick test with with 9.0.1 where that issue seems resolved. @IsError(@TextToNumber(…)) is mainly useful for Text fields, IMO.

Subject: I get it now; it works but is of very limited use

I was trying to use it to see if a certain portion of a text field had digits entered. @IsNumber cannot be used for something like this.

That would seem to be a natural way to use it. Various other comments I read involved doing something similar to what I’m doing. They thought it made sense too, so it’s not just me.

Thanks for getting me to look at it closer. It works, but is useless for anything I can think of in the apps I support. Maybe it’s more useful for dealing with number fields, but I rarely use those.

Subject: Validating Number fields

It definitely does make sense in Number fields; see also my previous post. For example, @If(@IsNumber(@ThisValue); @Success; @Failure(“…”)) in a Number field’s validation formula prevents a user from saving the document without filling-in the field, or from saving it with text filled into the field (which would result in the field containing an error).

Subject: Maybe @matches would do what you want?

Subject: Not in this case; it’s a text field and…

I want to so something special if a program number field starts with four digits instead of having one or more letters there. So @IsNumber(@Left(ProgNum;4)) would have been a simple solution … if it worked. Instead I have to use @IsError(@TextToNumber(@Left(ProgNum;4))) to test for the opposite outcome.

That’s simple enough once you figure it out, but it looks messier and less obvious. But hey it works and I can include a comment for whoever sees it next. :slight_smile:

Subject: Well that’s exactly the kind of thing @matches is intended for.

Example:TestValue := “1234Hello World”;

@If(@Matches(TestValue;“{1234567890}{1234567890}{1234567890}{1234567890}*”);“True”;“False”)

Subject: I stand corrected

It works but it’s not THAT much more readable than the other solution (in my opinion of course). I was thinking of letter matching when I made my earlier reply.

Thanks for pointing out that @Matches provides a valid alternative. I’d probably use it if I was just doing one character instead of 4.

Subject: Well it turns out I didnt’ write it in the most efficient manner.

Example:TestValue := “1234Hello World”;

@If(@Matches(TestValue;“{0-9}{0-9}{0-9}{0-9}*”);“True”;“False”)