Kevin Mutuma
Kevin Mutuma

Reputation: 51

Using the < and >Symbols in xml

I am working on a system that requires generating reports from a database. I have been trying to query a database to display data according to date added and date due. The problem is the data is not being displayed in the report. The Query is as below in the .jrxml file:

   <parameter name="dopened" class="java.lang.String"/>
   <parameter name="dended" class="java.lang.String"/>
   <queryString>
    <![CDATA[SELECT * FROM CASES WHERE date_due < $P{dended} ORDER BY case_no]]>
  </queryString>*

I have correctly declared the parameters "dopened" and "deneded" in the corresponding .java file as follows:

    params.put("dopened", dopen.getDate().toString());
    params.put("dended", dend.getDate().toString());

Iam using a date picker to choose the date. Kindly help in pointing out what i might be missing. Thanks

Upvotes: 2

Views: 89

Answers (2)

towe75
towe75

Reputation: 1470

Just a guess: you are using jasperreports or some similar solution.

The query shows a "where" clause with a date comparison which expects a Date object. The parameter "dended" is a String. You are converting "dended" with dend.getDate().toString() but the database surely expects another date format (think yy/mm/dd versus yyyy-mm-dd).

The Solution: change your parameters to java.util.Date or java.sql.Date and omit the conversion.

Upvotes: 0

Nirmal- thInk beYond
Nirmal- thInk beYond

Reputation: 12054

have you tried &gt; and &lt; instead of bracket ?

Upvotes: 2

Related Questions