duggggy Posted March 9, 2007 Posted March 9, 2007 Hi, newbie here. great forum, lots of useful tips. Been using it for a while now, before taking the pludge to join in. I've come across a problem, and I don't know how to solve it. Does anyone know a script that will check the value within a field and then change the background color to say red or green depending on whether the value is a positive or negative number? Any help or advice greatly appreciated.
mr_vodka Posted March 9, 2007 Posted March 9, 2007 Hello and welcome to the forums. You can try a search for +field +color and you will get a few hits regarding this matter. Here is one of them In your case the calc would be something like Case ( Sign (numfield) = -1; gBackround; gBackround[2] ) Where the first repetition of your container field would be a red image and the second green. Or if you were going to have a different color for zero then since you would need three colors, I would use a calc like. Choose ( Sign (numfield) + 1; gBackround; gBackround[2]; gBackround[3] ) Where the first repetition of your container field would be a red image for negative, the second repetition be orange or whatever color for zero, and the third repetition green for possitive amounts.
duggggy Posted March 9, 2007 Author Posted March 9, 2007 Hi, thanks for the the help. I get the Case function and the Sign function. What I need help with is the code to change the background color (the bit that goes in gBackround). I can't find any functions that reference background color to change it?
mr_vodka Posted March 9, 2007 Posted March 9, 2007 Did you do the search and read the thread that I pointed out? There were examples on there that were pretty straight forward. Click on the "Here is one of them". It is a link.
duggggy Posted March 9, 2007 Author Posted March 9, 2007 Whooops! missed the link. But did do a search for "gBackround" and found it that way. Having looked at the solution I was going completely in the wrong direction. The answer is very simple (the best way). Thanks for your help on this - much appreciated. Apologies for being a numpty.
Recommended Posts
This topic is 6470 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