Wade Posted November 9, 2005 Posted November 9, 2005 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
mr_vodka Posted November 9, 2005 Posted November 9, 2005 You can have a global calculation field that references that global field. Case (gField > 50000; TextColor ( gField ; RGB ( 255 ; 0 ; 0 ) ); gField )
Wade Posted November 9, 2005 Author Posted November 9, 2005 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
Kent Searight Posted November 9, 2005 Posted November 9, 2005 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.
mr_vodka Posted November 9, 2005 Posted November 9, 2005 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 )
Kent Searight Posted November 9, 2005 Posted November 9, 2005 How's that for service...two replies at the same instant with essentially the same answer. :beer:
comment Posted November 9, 2005 Posted November 9, 2005 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.
Kent Searight Posted November 9, 2005 Posted November 9, 2005 Good point, comment. But if formatting as a decimal is required, then the auto-enter calc could be enhanced to handle that also.
Wade Posted November 10, 2005 Author Posted November 10, 2005 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
comment Posted November 10, 2005 Posted November 10, 2005 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/
yknot Posted November 10, 2005 Posted November 10, 2005 Hi, How would I be able to get colors other than the generic red, blue & green? yknot
Kent Searight Posted November 11, 2005 Posted November 11, 2005 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
yknot Posted November 14, 2005 Posted November 14, 2005 Thanks for the reply - will try it asap. yknot
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now