Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1208
  • Last Modified:

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
0
bobrossi56
Asked:
bobrossi56
  • 8
  • 6
2 Solutions
 
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now