November 9, 200520 yr 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
November 9, 200520 yr You can have a global calculation field that references that global field. Case (gField > 50000; TextColor ( gField ; RGB ( 255 ; 0 ; 0 ) ); gField )
November 9, 200520 yr 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
November 9, 200520 yr 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.
November 9, 200520 yr 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 )
November 9, 200520 yr How's that for service...two replies at the same instant with essentially the same answer. :beer:
November 9, 200520 yr 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.
November 9, 200520 yr Good point, comment. But if formatting as a decimal is required, then the auto-enter calc could be enhanced to handle that also.
November 10, 200520 yr 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
November 10, 200520 yr 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/
November 10, 200520 yr Hi, How would I be able to get colors other than the generic red, blue & green? yknot
November 11, 200520 yr 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
Create an account or sign in to comment