Is there a way to dynamically change either the text color/styling or (preferably) the background color of a table cell based on a variable in a form?
I’ve attempted code like this:
@If(
status="Active";@Command([textsetfontcolor];[Green]);
status="Payment Received";@Command([textsetfontcolor];[Blue]);
status="Expired";@Command([textsetfontcolor];[Red]);
status="Inactive";@Command([textsetfontcolor];[Gray]);
@Command([textsetfontcolor];[Yellow])
)
but it comes back with an error indicating improper use of the @command.
Subject: use an image for the background
What I have done…set up several images in image resources that are just a 1X1 gif of the color you want.
Create a hidden field “bgimage”, type=text, computed for display. The formula would be something like:
@If(
Type=“Add User”; “au.GIF”;
Type=“Change User”; “cu.GIF”;
Type=“Remove User”; “ru.GIF”;
Type=“Change Passwords”; “pw.GIF”;
“white.GIF”)
This sets the text of the hidden field to the name of the gif to use for the cell background.
In the cell’s table properties, set cell color=none,. Under cell image, set source=computed and the formula is just “bgimage”. Tile, or stretch to fit.
The form properties should have “automatically refresh fields” enabled.
You can use this same technique to display a different image depending on the status, or some other value. Set the repeat to center, and be sure the cell size and iamge sizes are compatible. (ie specify a minimum height for the table and a fixed width for the cell, and make sure none of the images are larger than that.)
Subject: Thanks!!!
That worked incredibly well, thanks!