Search code examples
jasper-reports

Shift horizontal position of a field


How can we make a field to shift left if the preceding field is null/empty? I have 2 fields, ZIP and City. City is placed on the same line just after Zip. I want to shift City to left if Zip is empty. How can I do this?


Solution

  • Have two identical City text boxes, one where it is, the other behind the Zip field. Set the PrintWhenExpression property in that one to (zip==null). Set it in the original to zip!=null. (All necessary $F stuff omitted for brevity.)