FileMaker Pro 8.5 field fill color based on contents

I am using this code:
Case ( Amt > 0 ; TextColor ( Amt ; RGB ( 0 ; 254 ; 0 ) ) ;
       Amt = 0 ; TextColor ( Amt ; RGB ( 0 ; 0 ; 0 ) ) ;
       Amt < 0 ; TextColor ( Amt ; RGB ( 254 ; 0 ; 0 ) ) ;)

to change the text color based on field content.

I tried the F1 help to see if there was a similar method to change the FILL color of a field based on content, but I found nothing. Can that be done as well.
thx experts...
BobR
bobrossi56Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jvaldesCommented:
Best way to do that is to put the colors that you want to display into a repeating container field. Then Place the Field text over the container field and activate the repetition of the fill that you want to display. If you need an example let me know
0
bobrossi56Author Commented:
I am an FM Pro newbie so you've lost me. An example would be wonderful.
thx
0
D0NCommented:
Picture it as storing different colored boxes in container fields.  As jvaldes mentioned, a repeating field is the way to go.  Fill repetition 1 with red, repetition 2 with green, etc.  Display the appropriate color then (using a transparent background) place your numberic (or whatever) field over the top of that color.  

If you can upgrade to v9, you'll get built in "conditional formatting" which is exactly what you're looking for.  It allows you to change field formatting based on the value that's in the field.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

bobrossi56Author Commented:
When you say "repeating container" field I do nto understand what you mean. I went into define database and added a new container field and I called it cont1. I filled the field with red. How do I make it repeat and use different colors?
thx
0
bobrossi56Author Commented:
OK, I set up field "cont1" to repeat twice and it now shows up on the layout as cont[1] and cont, looks like 2 boxes now. However, when I click to fill the field with a color BOTH boxes fill with the same color. How do I get cont[1] as red and cont as green?
thx
0
D0NCommented:
You're almost there.  Draw a green-filled box and drop into one repetition, create a red-filled box and drop it into the other repetition.
0
bobrossi56Author Commented:
OK, done. Still confuse though. SO now I have this cont1 container field, 2 repititions, one repitition has a red box dropped over it, the other rep has a green box dropped over it.

How do I get field "cont1" to show green when field "total" is greater than 100 and show red when lit's less than 100 ?
thx
0
D0NCommented:
Create another container field (there's another way to do this using the same field, but I won't confuse you), then make that field display the repetition you want like this:

Case ( total < 100 ; cont1[1] ; cont1[2] )
or
Case ( total < 100 ; GetRepetition ( cont1 ; 1 ) ; GetRepetition ( cont1 ; 2 ) )
0
bobrossi56Author Commented:
Tried this, and I am getting SO close, but still not working. I am sure its something stupid I am doing. I have attached a small database that I am using to try to get this to work. Perhaps you can take a quick look at it and see the rrro of my ways. Just rename it from test.txt to text.fp7.
thx much...
test.txt
0
D0NCommented:
Here you go
test.txt
0
bobrossi56Author Commented:
OK, but a few ???
1. I don't see the reason to put the total field over cont2, because no matter what value is in the total cont2 shows as red.
2. Why are there now 2 cont2 fields on the form?
3. You annotated that cont2 needs to be a calc, but I did have it as a case calc.
4. I do see cont2 change colors depending on the total, but its a bit "kludgy" meaning that when its <100 the cont1 field is colored red/red, and when its >100 its colored green/red. The red/red is fine because red is red, but the green/red is just confusing.
5. Don't have any idea what this annotation means - While in layout mode, I copied your black box, then went into browse mode and pasted it into repetition 1

thx
0
D0NCommented:
Hmmm...
1.  When I made total come out to less than 100, cont2 changed to black, when greater it changed to red.
2.  I just duplicated your cont2 field
3.  When I got it, cont2 was a container field.  However, at one time it looked like it was a calculation field as when I changed it to a calculation field, it had the calculation already there.
4.  Don't look at cont1 field, it's just holds colors your going to use.  Other than to "fill it", you don't need it on the layout at all.
5.  You need to get at the colored object to be able to copy it.  You can't get at it in browse mode.  (Incidentally, I didn't see a green... only black and red).
0
bobrossi56Author Commented:
Weird, I see red and green.
OK, I understand your answers, but if I don't look at cont1 field, then all I see is cont2 field and that never changes color no matter what the total is.

I am confused by the copy and paste colored object. Do you have to do this for every new record? if so that was not my intent. In fact, when I use the test DB and create new records nothing changes color. Only the 2 records you put in there change color, and even those only change in cont1, cont2 with trans total always show red.
thx
0
D0NCommented:
Sorry, my fault, conf1 should be a global field.  It does nothing more than hold your color pallet.  It's the same for all records.
If total is less than 100 your calculation should grab the appropriate color (repetition) that you specify, if it's greater than 100 it should point to the other repetition.
0
bobrossi56Author Commented:
No prob, OK, now it works like I had visualized. Thanks for sticking with me and being patient. I appreciate all your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FileMaker Pro

From novice to tech pro — start learning today.