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.

Change color of number in a gField

Featured Replies

Is it possible to change the color of a number in a global field via a script calculation? I would like any number that exceeds $50,000

to be seen in red.

I looked at the case and let functions but I guess I don't understand them because I can't get it to work.

Is this even possible?

thanks

Arapahoe

You can have a global calculation field that references that global field.

Case (gField > 50000; TextColor ( gField ; RGB ( 255 ; 0 ; 0 ) ); gField )

  • Author

thanks for the reply John.

Is the field in your solution (gField) the field that I want to change color or a new global field that I should create.

I guess I'm confused when you say you can have a global calculation field that "references" the original calculation field???

I only see a reference to (1) field (gfield) in your slolution.

thanks

Arapahoe

It's referencing itself. Make your field is an auto-enter calculation, not a calculation field. Make sure that "Do not replace existing value for field (if any)" in the Options for Field dialog is unchecked if you want it to update.

In your global field that you stated earlier (gField), make it a calculated value (Define field--> Auto-enter tab). Make sure that 'do not replace exisiting value..." is unchecked.

then put in formula.

Case (gField > 50000; TextColor ( gField ; RGB ( 255 ; 0 ; 0 ) ); gField )

How's that for service...two replies at the same instant with essentially the same answer. :beer:

I'll have to disagree with both of you:

If gField is a number field, auto-entering a text formatting function will work - but only if the number is left unformatted. When you format the field to display the number as decimal, it will stop working.

Good point, comment.

But if formatting as a decimal is required, then the auto-enter calc could be enhanced to handle that also.

  • Author

Friends, thanks.

I did get it to work. So... How do i get it to color the number red if it is formatted as a number with decimal places and a $ at the front?

I'm almost there can you still help me?

Thanks loads

Arapahoe

Yes - but then it cannot be a number field any more. This may be unimportant in most cases, but can become critical when it comes to sorting, for instance.

Arapahoe:

The formula can be a simple one or a quite complex one - it depends on (a) what kinds of numbers you expect to put in the field - the chief concerns are negative numbers and numbers that need rounding to 2 decimal places, and (b whether you want thousands separators or not.

See the formulae in these two threads - one is very simple, the other has just about every trimming you can think of:

http://fmforums.com/forum/showtopic.php?tid/140673/

http://fmforums.com/forum/showtopic.php?tid/152750/

Hi,

How would I be able to get colors other than the generic red, blue & green?

yknot

Sometimes I just go into Layout Mode and select an object so I can use the color picker. That's one way. Another is to use a simple example like the one attached. Just put in any values between 0 and 255 into the R, G, and B fields and the swatch will display that color.

colors.zip

Thanks for the reply - will try it asap.

yknot

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.