gdotzlaw Posted March 4, 2010 Share Posted March 4, 2010 I have a Text field (java.lang.String), and want to have an expression like this:$F{TYPE1} + "\t" + $F{PHONE1} + "\n" +$F{TYPE2} + "\t" + $F{FIELD2}to acheive output that looks like:Phone (847) 719-2290Fax (847) 719-2291So, my proble is the new line escape sequence ("\n") works great, but the tab is ignored, so my output looks like thisPhone(847) 719-2280Fax(847)719-2291What am I doing wrong? Link to comment Share on other sites More sharing options...
slow Posted March 10, 2010 Share Posted March 10, 2010 I think it's better to work with separate cell (column), one for the TYPE and another for the number, so you can control the pixel-range between them.the escape sequence "\t" seems to be useless in a format lyke pdf, xls... Link to comment Share on other sites More sharing options...
gdotzlaw Posted March 11, 2010 Author Share Posted March 11, 2010 Yes, I know how to place fields on the layout. My question was related to building an expression that can accomodate whether or not data is present, collapsing or expanding based on data being present. The latest version of iReports informed me that valid escape characters included the "\t", but since it does not work, it is either a bug, incorrect documentation, or I am simply not using it correctly.Anyway, here is what I am trying to do. Suppose I place the following fields on my detail band.COMMTYPE1 COMM1COMMTYPE2 COMM2COMMTYPE3 COMM3Assume now, if COMMTYPE2 and COMM2 are blank, COMMTYPE1, COMMTYPE3, COMM1 and COMM3 contain values. I do not want COMMTYPE2 or COMM2 to take up space in the detail band, so what should print is:COMMTYPE1 COMM1COMMTYPE3 COMM3The question now becomes (since I can not build an expression that checks for blanks and uses "\t" to indent and "\n" to start on a new line) is there a way for fields placed on a layout (COMMTYPE3 and COMM3 in this example), to slide up, based on the object(s) above?I don't see how to accomplish this in iReports, unless one has to create a subreport. Link to comment Share on other sites More sharing options...
gdotzlaw Posted March 11, 2010 Author Share Posted March 11, 2010 Never mind...I just figured it out. Set the "Remove Line when Blank" option for the fields, and that shrinks the detail band when the fields are blank. Link to comment Share on other sites More sharing options...
bakkarj Posted March 12, 2010 Share Posted March 12, 2010 Ok, fine but how did you solve the "\t" Problem? Is there an HTML look-like Table? The crosstab isn't the solution because it has to be binded with the datasource and i want to specify my own expression.SeeyaCode:"Date\t\t" + $F{invoiceDate} + "\n" +"Echéance paiement\t\t" + $F{dueDate} Link to comment Share on other sites More sharing options...
gdotzlaw Posted March 12, 2010 Author Share Posted March 12, 2010 I did not solve the "\t" problem; iReports/Jasper does not support it, so it must be a bug in the software (since it indicates that it is one of the supported escape sequences. I simply placed individual fields for 7 COMMTYPE and 7 COMM fields, and set them all to "remove line when blank" so that they disappear when not being used.I did mess around with trying to get an HTML table to work without any success, so I think individual fields is the only solution to my problem.I did not need to use subreports. Link to comment Share on other sites More sharing options...
bakkarj Posted March 12, 2010 Share Posted March 12, 2010 Okey Thanks! Did you know if a bug report has been wroten for the \t bug? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now