Jump to content
Server Maintenance This Week. ×

Changing layout color by field entry


Basso Tim

This topic is 6548 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I would like to change the background color in my contacts database to reflect if someone has died, i.e. when the radio button for Deceased? is marked Yes then the background colors would change to grey or black.

Is this possible?

Link to comment
Share on other sites

There are several ways to do this but the most straightforward method is to store your background swatch in a global container field. Just draw a small rectangle in layout mode with the color background you want. It can be as small as 1 pixel by 1 pixel if you want. Cut the rectangle from the layout to the clipboard. Enter browse mode and paste the swatch into the global container field. You don't need to display the global field on any layout. Then, create a calculation with the following formula:

Case(RadioButton = "Deceased"; GlobalContainerField)

Place the calculation field on the layout where you want the background displayed and make it as large as the entire layout area. Make sure to set the field to not allow entry in browse or find mode via the Field Behavior dialog. Also, make sure you send the calculation field to the back of all the other objects. Finally, with the calculation field selected, choose Graphic... from the Format menu and set it to Enlarge and uncheck the option to "maintain original proportions".

Link to comment
Share on other sites

That is SO COOL!

In my database your formula was actually Case(Deceased = "Yes"; BackgroundColor) because that is how I set up the fields. I include that because it might help clarify for others who are checking this out.

Thank you very much.

Link to comment
Share on other sites

What if I wanted the background color to be changed by more than one thing?

For instance:

radio button- Deceased (Yes, No) Grey

drop down- Category (Alumnus, Friend, Family) Red, Green, Brown

Of course deceased grey should take priority over the other colors.

How could I do that?

Link to comment
Share on other sites

Make your global container field a global container with as many repetitions as you want background colors. Paste the swatches into the different repetitions of the global field and then change your formula to something like this:

GetRepetition(

xGlobalContainerRepeatingField;

Case(Category = "Alumnus"; 1; Category = "Friend"; 2; 3)

)

Link to comment
Share on other sites

I think I must be doing something wrong- the container field I created, and then put a color into each repetition. I then resized it and made it into my background but the other colors were still present to the right. There must be a place where I choose only to view one repetition at a time, right?

The calculation did not change anything probably because of the set up of the container field...

As in the example from the other post, I changed the field setup to display 1 repetition. The calculation does not work yet though.

Link to comment
Share on other sites

This topic is 6548 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.