Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I was reading this post about credit card number formatting, and went to take a look at Brian Dunning's "Credit Card Validator" file, which works only with FM5 and FM6.

I converted Brian's file using DEV7, and the behavior of the program changed. Card numbers that were valid prior to conversion were now invalid.

I poked around the calculations, looking for oddities in the conversion, and found what might be a bug in FM7. If you look at the calculation "HalfDoubledCC" in Brian's file in FM6 and compare the calculation result in FM7, the results are very different. Here's why:

In FM6 and FM7, if you enter a 5-digit numeric value into a text field ("field"), and then create a calculation as follows:

Middle( field, 6, 1)

the result is empty, because there is no 6th position in the string.

However, now create a calculation similar to Brian's calc (noted above), using a multiplier:

2 * Middle( field, 6, 1) or, in FM7: 2 * Middle( field; 6; 1)

FM6 returns an empty result. FM7, however, produces a result equal to the string multiplied by 2. So, if the value of the string is "12345", FM6 returns nothing, but FM7 returns 24690.

I've attached two small files: the first file was created in FM6 and the second is the same file converted to FM7. Take a look at the calcs and results. I'd appreciate your input about whether this is a bug or a feature. smile.gif

Thanks a lot.

FileMaker Version: Dev 7

Platform: Mac OS X Panther

Wierd_Calc.zip

Posted

IMHO it's a bug. I changed the calc to this:

2 * GetAsNumber(

If( IsEmpty(Middle(SomeText; 6; 1));

"0";

Middle(SomeText; 6; 1)

)

)

and it properly returned 0. FYI: it returned the wrong result with: 2 * GetAsNumber(Middle(SomeText; 6; 1))

So, Middle(SomeText; 6; 1) can be properly evaluated as empty. So why didn't 2 * properly evaluate Middle(SomeText; 6; 1)? My suspicion is the calculation parser has improperly handled Middle returning an empty string when the operand is numeric.

This topic is 7520 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.