mstanton Posted August 14, 2009 Share Posted August 14, 2009 Hello, 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: if(Len(Field("Website")>50)) 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. Thanks! Link to comment Share on other sites More sharing options...
esmith Posted August 17, 2009 Share Posted August 17, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.