forstera Posted March 29, 2011 Share Posted March 29, 2011 Hello all,I'm really new in jasper, so doesn't know if possible ...I need to print a product name. If this product name has a code, the variable to print will be formed by the product code and the product name. The product code will be placed between [ ]. So, it will look like this :[My product code] Here's my product nameIf the product has no code, onl y the procduct name will be displayed. What I've to do is : if there's a code, I need to remove the [ ] and if there's no code, so I've to fill with white spaces (15). The idea, when printing, is to have always the first column reserved for the product code .So, I don't know if there's a function to find a char in a string. According to the fact that when there's a product code, the first char of the sring will be a [, I need to know where will be the ] char (the code has not always the same length).is there a way to do that ? Per advance, thanks very much for your helpBest RegardsArnaud Link to comment Share on other sites More sharing options...
gervase Posted April 21, 2011 Share Posted April 21, 2011 You might be able to do this in your SQL as a CASE statement: (CASE WHEN table.productcode is null THEN 'product name' ELSE table.productcode END) as PRODUCTCODE Does that sound feasible? Link to comment Share on other sites More sharing options...
mdahlman Posted April 21, 2011 Share Posted April 21, 2011 Arnaud,Try something like this:$F{prod}.substring( $F{prod}.indexOf( ']' ) + 1 ) gervase,It seems like you might be answering a different question. Regards,Matt 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