Skip 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.

Script calc help please

Featured Replies

I need to understand better how FMP handles calculation and data type conversion and hope you guys can provide the clarity. Here is the situation...

If I use script;

SetField(field 1 text type; (field2 text type & (field3 type number – integer)))

When field2 = CB

Field3 value = 0055

and integer = 5

Why is the result CB50 instead of CB0050?

Yet when I do the same thing without the integer subtraction the result is CB0050?

TIA,

K

Leading zeroes are ignored in FileMaker arithmatic. If you wish to pad your result, you'll need to treat it as text:

Field2 & right("0000" & Field3 - integer; 4)

  • Author

Ok. Thats what i thought. next question then... how do you explain setting the field type to number and set for auto fill as serial on creation with next increment value 0001 keeps the padding zeros? Is this field actually text then?

It IS difficult to explain. It really shouldn't be like that. Seems that Filemaker tries to be tolerant and remembers the leading zeros in case you want to use the field in a TEXT calculation. But when the field needs to be evaluated AS NUMBER, the leading zeros MUST be ignored.

  • Author

Is the calculation precedence / data type promotion hierarchy documented anywhere or we at the mercy of the designers? Kind of like playing pin the tail on the donkey if we are.

Kris

The order of evaluation is standard, and I believe it is documented as well. Type conversions are pretty obvious, according to the operator used and the type of result selected.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.