March 9, 200718 yr 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.
March 9, 200718 yr 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.
March 9, 200718 yr Author 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?
March 9, 200718 yr 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.
March 9, 200718 yr Author 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.
Create an account or sign in to comment