Jump to content

Change Graphic Resource based on String Length of a Different Text Field


Recommended Posts



I am wondering if there is a way I could make a particular graphic appear if there are more than 50 characters in a certain text field. My reason for doing this is that when the line reaches 50 characters, it hits a background color that is too similar to the font color. I want to place a graphic behind that section of text that will help the text show up better. I don't need/want it to be there, though, if the text is less than 50 characters.


I have tried this rule:


return Resource("BKG")
else return Resource("BKG2")

where BKG is the darker section of the background graphic and BKG2 is the same section of the original background.



Link to comment
Share on other sites

Your logic looks right, but your formatting is wrong. It should be written as:

if(Len(Field("Website")) > 50) {
   return Resource("BKG");
else return Resource("BKG2");

You had a closing parenthesis in the wrong position in the first line, and no brackets "{}" around the first return. You are also forgetting to end your lines with a semicolon. As a result, the code executes the first return statement every time. Technically, you could also simplify your code to:

return (Len(Field("Website")) > 50) ? Resource("BKG") : Resource("BKG2");

Of course, this should be a graphic rule since it returns a graphic element. :)

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...