I have an Jasper report that put my data into csv and I need something like this:
$F{OBSERVATII}.split(" ").size()>=2 ? ($F{OBSERVATII}.split(" ")[0]+" "+$F{OBSERVATII}.split(" ")[1]+" "+$F{OBSERVATII}.split(" ")[2]) : $F{OBSERVATII}
but Jasper throws me an
Cannot invoke size() on the array type String[]
If I put only
$F{OBSERVATII}.split(" ")[0]+" "+$F{OBSERVATII}.split(" ")[1]+" "+$F{OBSERVATII}.split(" ")[2])
then, when I have an simple word string (without spaces) it gives me an error...