Jump to content

is there an IsNumber type of fn?


This topic is 7001 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

suppose that you have a field, say it's called Amount and you are doing your own validating of the field - not using filemakers built in validation features.

Your user types ? in the field. Is there a function which you can use to look at the fields to see if it's really a number/currency? Something like if [isNumber ( projects::amount ) = 1] ??

I looked through the help and did a search on this forum and I didn't see a solution.

thanks for the help in advance,

sincerely,

J__

Link to comment
Share on other sites

Here's my test for numeracy. However, it does NOT work on a number field. It only correctly validates numbers entered in text fields (at least in FM6). The reason why? FileMaker's number processing makes certain "corrections" to invalid data. For example, if you enter a1.5d in a number field, or run that through NumToText(), it will evaluate as the number 1.5. Which kind of makes sense. What if they enter 123a5? Guess what -- that evaluates as 1235! It just ignores the letters. More annoying is that if they enter something like 12.2.1 (note the two decimal points) it ignores the second decimal point and evaluates it as 12.21. Similarly, it tosses out spaces, symbols... anything that's not a number. It keeps any numeric digits, and strings them together to form the final result.

comment's er.. comment is correct. IsValid(Amount) will tell you whether there's a number in the field or not. But it will only return 0 (false) if there are NO numbers in the field. As I've said above, if there are numbers (and other stuff) in the field, you might not get what you expect.

If you want to enter the number in a text field, you can use the following check to validate that it's a number, only has one decimal place, has no text in it, etc.

If(Left(TextField, 1) = "-",

NumToText(TextToNum("1" & Right(TextField, Length(TextField) - 1) & "1")) = ("1" & Right(TextField, Length(TextField) - 1) & "1"),

NumToText(TextToNum("1" & TextField & "1")) = ("1" & TextField & "1")

)

Link to comment
Share on other sites

IsValid - right! I knew there was something that did that, but I kept on thinking "IsNumber".

I'll check it out - thanks.

And underhat - thanks for your response, this may come in handy.

thanks,

Sincerely,

J__

Link to comment
Share on other sites

This topic is 7001 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.