BuffaloPrintingCo Posted April 6, 2012 Share Posted April 6, 2012 I have the java code below: return Field("Address 1")+' '+'•'+' '+Field("City State Zip 1")+' '+'•'+' '+Field("Phone 1"); Fields Address 1, City State Zip 1, and Phone 1 all exist and it's supposed to put a space then a bullet then another space between the three fields. When it previews, it actually put the text • in there instead of the actual characters. What am I missing? Link to comment Share on other sites More sharing options...
ThomasLewis Posted April 6, 2012 Share Posted April 6, 2012 Check the box in the upper right of the rule window that says "Treat returned strings as tagged text". Link to comment Share on other sites More sharing options...
BuffaloPrintingCo Posted April 6, 2012 Author Share Posted April 6, 2012 Great! thanks, that got the actual characters to show up but now my issue is this. I have 4 lines of this code with Address 1, Address 2, etc etc and not all the fields always get filled in. How can I make it so that the symbols disappear when there is no variable field filled in? Link to comment Share on other sites More sharing options...
ThomasLewis Posted April 6, 2012 Share Posted April 6, 2012 Here's an example of one way it could be done: var addr1 = Field("Address 1"); var addr2 = Field("Address 2"); var spacer = " • "; if (addr1.length > 0) addr1 += spacer; if (addr2.length > 0) addr2 += spacer; return addr1 + addr2 + Field("City State Zip 1") + spacer + Field("Phone 1"); It checks the string length of the value for those fields. If there is more than 0 characters, it appends the spacer string. Link to comment Share on other sites More sharing options...
BuffaloPrintingCo Posted April 6, 2012 Author Share Posted April 6, 2012 Awesome! With a couple tweaks I was able to make it work perfectly for our application of it. Thanks a lot Thomas! Definately got this taken care of a lot faster than i expected. Happy Easter! J Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.