Conditional expresion in a dataset parameter

Hi all,

I have a .jrxml report connected with MongoDB. Inside this reports I have a table with many Dataset parameter in order to create dinamically the query, unfortunately I have problems with one of this parameters, it looks like:

($P{Owner}==null || $P{Owner}.equals(""))
?new String("")
:($P{Owner}.equals("Pool"))
?"$and:[\"OpnPrps.CurAgtNme\":null,\"Nms.CloAgt\":null]"
:"$or:[\"OpnPrps.CurAgtNme\":\""+$P{Owner}+"\",\"Nms.CloAgt\":\""+$P{Owner}+"\"]"
 
My problem is that when I preview my reports, the $and, $or part of my query can't be executed and I have the following error:
 
net.sf.jasperreports.engine.JRException: com.mongodb.util.JSONParseException: 
{
'findQuery' : {
"OlaDat":{'$lte':{ "$date" : 1434438846714},'$gt':{ "$date" : 1402902732089}},
$and:["OpnPrps.CurAgtNme":null,"Nms.CloAgt":null],
"Nms.Src":"e-mail"
}
 
Is there any way to change this conditions in order to get evaluable values inside a dataset parameter?
Any help,please?
 
Thanks in advance.
Kind regards.
alba.ortega's picture
Joined: Feb 25 2015 - 7:08am
Last seen: 7 years 10 months ago

Ok I found the mistake myself, the problem was I missed two { } between objects.

$and:[{"OpnPrps.CurAgtNme":null},{"Nms.CloAgt":null}] 

alba.ortega - 8 years 3 months ago

0 Answers:

No answers yet
Feedback