Conditional expresion in a dataset parameter

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.

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: 6 years 8 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 - 7 years 3 weeks ago

0 Answers:

No answers yet
Feedback
randomness