Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Weird text field calculation result in FM7

Featured Replies

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

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.

I concur; i believe it to be a bug as well. However if it's not a bug, it's a purdy unusual "feature".

smile.gif

FileMaker Version: Dev 7

Platform: Windows XP

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.