Forum post
I am looking for a script / method of changing the color of a field based on the value in another field. How do you do that?
Example; IF Field:customer = AMAT, then Field:action = the fill color red
I would really appreciate the help here.
Answer
Right click on the field you wish to format, then choose Conditional Formatting.
You can then set up formula's such as Field::Customer = "AMAT"
Then specify the colour options etc if that is true.
If you wanted to apply conditional formatting using the same calculations to other fields etc, select them all first, then right click and choose conditional formatting. This will apply the formatting to everything selected.
Be the first to like this
|
Sign in to "Like"
Thanks for the assistance.
But I think I have the format wrong. What is the proper format to put in the Formula Is area?
I keep getting a return saying that it cannot find my field.
The condition field is "Top 30 Customer Type"
The resulting field that I would like to change the color in is "Color Block"
Be the first to like this
|
Sign in to "Like"
You would apply the conditional formatting to the "Color Block" field
Forumula is :
Top 30 Customer Type = "AMAT"
You may need to prefix the field name with the table name, but if you click specify you can select the field from the available list and it will format it correctly for you i.e
CustomerTypes::Top 30 Customer Type = "AMAT"
Be the first to like this
|
Sign in to "Like"
Is there a way to change the fill color without using conditional formatting? I'd like to do this because conditional formatting is not available in instant web publishing.
Be the first to like this
|
Sign in to "Like"
Create two calculation fields: If ( conditionalExpression ; FieldName ; "" )
Format each with a different color, stack them on top of each other with a transparent fill color and use conditional expressions that will always leave one field blank and the other displaying data. (That's how we did this in older versions without conditional formatting. Don't see why it wouldn't work with IWP.)
Be the first to like this
|
Sign in to "Like"
Thanks Phil
Unless I am missing something, the transparent fill pattern implies no fill color, so the approach you suggest does not seem to work for my purposes. However, it does allow me to use indentation rather than background color to convey the difference between my data, which seems good enough :)
thanks again,
Be the first to like this
|
Sign in to "Like"
Good point as I was thinking in terms of changing the text color rather than the fill color. To do that you can set up a calculation that returns a container type. It can return the contents of a container field that has a red rectangle in it to show a red "fill color" and it can return the contents of a container field with a blue rectangle to show a blue "fill color"...
Now put this field behind your transparent data field to show a "fill color" change.
Be the first to like this
|
Sign in to "Like"