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.

Is there a way to set field formatting via script?

Featured Replies

I have a field (concentration) that is a calculation based on three other fields:

1. Total volume (i.e., 25 ml)

2. Volume of chemical added (i.e., 0.00035 g)

3. Purity of chemical added (i.e., 99.8%)

The field calculates a ppm value based on these three numbers, no problems there. The issue I have is that I need to be able to calculate the number of significant figures in each of the three source fields, then display the result with the proper number of significant figures.

[0.00135 g (3 SF) x .99 (2 SF) ]/25.0 ml (3 SF) = 53.46 ppm, but it has to appear as 53 ppm because the result has to equal the least number of significant figures in any the source fields.

[0.00135 x .998]/25.0 = 53.9 ppm

[0.001350 x .9980]/25.00 = 53.89 ppm

So the field display has to change based on the calculation. I have the sigfigs custom function, but I'm trying to figure out how to apply it. Do I just need to format the field as "general" and set the significant figures via a script using the custom function, or is there a way to script the field number display formatting?

Hello Moon Rabbit!

I am not clear on your need but since this hasn't been answered, I will give it a go.

"So the field display has to change based upon the calculation"

If you are saying that, in one calculation result, the field should display 53.9 ppm and in another it should display 53.89 ppm, are you saying that the rounding would be what changed depending upon the results of your custom function? If so then there are two approaches (create another calculation to display the result or use conditional formatting and merge variable. What you do NOT want to do is use script for it but rather, you want it to be automatic.

[0.00135 g (3 SF) x .99 (2 SF) ]/25.0 ml (3 SF) = 53.46 ppm, but it has to appear as 53 ppm because the result has to equal the least number of significant figures in any the source fields.

What are the 'significant figures' in this string? Please translate this into human speak. :) It would probably help if you provided a sample file with your custom function and the concatenated calculation with a few records.

When it comes to numerical operations, a field containing the entry "25" is practically indistinguishable from another containing "25.00". Filemaker provides the option of displaying the entries "as entered" - but any numerical operation will treat them the same way.

The other thing is that a calculation resulting in a Number will never have trailing zeros. For this, you must set the field to return a Text result and do your own formatting within the calculation formula.

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.