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

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

Recommended Posts

Posted

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

Posted

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

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

Posted

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

Posted

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.

Posted

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 )

Posted

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

Posted

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.

Posted

Good point, comment.

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

Posted

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

Posted

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/

Posted

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

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