Jump to content

Changing text or background?


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

Recommended Posts

Hi,

This may be a calculation rather that a script requirement?

Basically I need to change either the background colour or the text colour based upon a choice of Yes or No.

So if a field = "Yes" then I want to change the background to say red(or the text) and if the field = "No" then I want to have the field change to say Green!

I thought of having a container with a graphic colour saying yes and a graphic colour saying no and setting the field with the necessary colour but I need to use the words Yes or No and I can't do this using a container.

I need to "Get Graphic Colour" somehow?

Can anyone help?

Link to comment
Share on other sites

Create a calculation whose output type is Container (down in the lower left of the Define Calculation):

Case(myfield= "Yes", backgroundfield, "")

Put background file behind the input field, same size. The calc field should be set to not allow entry. You can put whatever color you want into the backgroundfield.

Steve

Link to comment
Share on other sites

If the background need only cover a few lines, you can use this method without container fields. Just have the calculation field with a formula similar to this:

Let( a ="llllllllllllllllllllllllllllllllllllllll" ;

Case(field="YES"; TextColor( a ;RGB( 200;0 ;0)) ; TextColor( a ;RGB( 0;200 ;0)) ) )

Those are lower case l's, bold, sized, sans serif - duplicate the field to cover the gaps. The group of l's can have returns in the formula to cover more verticle area.

Also, in your case, in lieu of l's, you could use the words YES and NO.

The advantage here is flexibility. You can easily add, or change, a rainbow of meaning in seconds without adding or changing container fields. A Left function can even determine the width of the highlight.

David

Link to comment
Share on other sites

This topic is 6670 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.