z178 Posted September 3, 2007 Posted September 3, 2007 I have a layout with 3 radiobuttons for setting priorities. (Urgent, Normal, Low) I would like to change the color of the text in a different field based on the choice a user makes on the radio buttons. Sorry these questions are elementary scripting questions... What is the function that returns the value from a field? AND what is the function that can be used to change the color of a text in a field?
LaRetta Posted September 3, 2007 Posted September 3, 2007 (edited) You don't need a script - only apply an Auto-Enter calculation to your [color:blue]text field (the one you wish to change colors). Insert this calculation in the Options, Auto-Enter, calculated value: Case ( [color:blue]radiobutton = "Urgent" ; TextColor ( [color:blue]text ; RGB ( 255 ; 0 ; 0 ) ) ; [color:blue]radiobutton = "Normal" ; TextColor ( [color:blue]text ; RGB ( 0 ; 255 ; 0 ) ) ; TextColor ( [color:blue]text ; RGB (0 ; 0 ; 255 ) ) ) Change [color:blue]radiobutton to the name of your radio button field. Change [color:blue]text to the name of your text field. Change your colors as needed. Be sure to uncheck (also on the Auto-Enter tab), the checkbox 'Do Not Replace Existing value.' Modify this calculation depending upon your needs. If you need help, let us know. :wink2: Edited September 3, 2007 by Guest Corrected calculation
z178 Posted September 3, 2007 Author Posted September 3, 2007 (edited) Thank you very much. One more thing. Do I need to explicitly reference the radiobutton or the field if the change in color is expected in a different layout? Edited September 3, 2007 by Guest
LaRetta Posted September 3, 2007 Posted September 3, 2007 (edited) No, when you reference a field within the field definition window, then it applies to that field everywhere (because you specify the context within the calculation dialog itself). UPDATE: Let me rephrase that a bit ... if you place that calculation on different layouts, it will work the same. But yes, you must reference the fields within it. And, if the layout is related to the table where the field exists, it will work. In other words ... I have no idea what you are getting at and I'm punting right now. :wink2: Edited September 3, 2007 by Guest
comment Posted September 3, 2007 Posted September 3, 2007 Isn't this about version 9? Why not use conditional formatting? Old habits die hard? Are there enough questions here?
LaRetta Posted September 3, 2007 Posted September 3, 2007 (edited) I tried conditional formatting. But I could not get more than two options in it. I could not make it work, Michael - only work like boolean - format or not format. Please show how 3 different colors based upon 3 different criteria might look in one calculation ... I tried both value and formula. And no, not too many questions! ROFLMFAO! I've only played with conditional formatting a few times now making text disappear by changing it to background color, etc but nothing multi-criteria. Ha ha! Edited September 3, 2007 by Guest
comment Posted September 3, 2007 Posted September 3, 2007 They need to be in reversed order, compared to what you would do in a Case() function.
LaRetta Posted September 3, 2007 Posted September 3, 2007 (edited) Formula is test::radiobutton ≠"Low" and test::radiobutton = "Urgent" ( format red text ) Formula is [color:red]test::radiobutton ≠ "Urgent" and test::radiobutton = "Normal" ( format green text ) There might be simpler ways but this works. UPDATE: First line removed - default unnecessary. Added: default color is whatever you wish - black or blue or ... ha ha REMOVE THE PART IN RED! Edited September 3, 2007 by Guest
comment Posted September 3, 2007 Posted September 3, 2007 Somehow I forgot this was based on a radio button - I was already thinking how to make this with ranges. With a radio button, it is indeed simpler, because only one condition can be true, so the order doesn't matter. Formula is test::radiobutton = "Urgent" ( format red text ) Formula is test::radiobutton = "Normal" ( format green text )
LaRetta Posted September 3, 2007 Posted September 3, 2007 I kept whittling on it. I was certain I had tried that at first and it didn't work. But it does now. I realize it was because I was attempting to put a Case() statement within it.
comment Posted September 3, 2007 Posted September 3, 2007 Here's an example of a pseudo-Case conditional formatting. ConditionalFormatByRange.fp7.zip
LaRetta Posted September 3, 2007 Posted September 3, 2007 That reverse evaluation is going to take some getting used to. Thank you!
Recommended Posts
This topic is 6293 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