Jump to content
Changes to the Jaspersoft community edition download ×

Possible Date evaluation issues


2005 IR Help

Recommended Posts

By: Mykel Alvis - evilarchitect

Possible Date evaluation issues

2004-09-20 10:32

I have a very generic, very scriptlet-based report that I pass a number of parameters to.

The select is as follows:

----------------------------------

SELECT $P!{prm_select_star}

FROM $P!{prm_select_from}

WHERE $P!{prm_pre_where}

(

$P!{prm_qry_xy_where}

(

qry_XY >= $P{fromXY} AND qry_XY <= $P{toXY}

AND

qry_item_type >= $P{fromType} and qry_item_type <=$P{toType}

AND

item_date >= $P{fromDate} AND item_date < $P{toDate}

)

)

AND

company_uid = $P{prm_companyUID}

$P!{prm_selection_formula}

 

ORDER BY

$P!{prm_order_by}

----------------------------

 

Usually prm_pre_where, prm_qry_xy_where, and prm_selection_formula are blank (actually left as default, which is " "). Parameters (and defaults) as follows:

-----

<parameter name="fromDate" class="java.util.Date">

<parameterDescription><![CDATA[being Date of Report]]></parameterDescription>

<defaultValueExpression><![CDATA[new Date(0L)]]></defaultValueExpression>

</parameter>

<parameter name="toDate" class="java.util.Date">

<parameterDescription><![CDATA[End Date of Report]]></parameterDescription>

<defaultValueExpression><![CDATA[new Date()]]></defaultValueExpression>

</parameter>

<parameter name="fromXY" class="java.lang.Long">

<parameterDescription><![CDATA[From XY]]></parameterDescription>

<defaultValueExpression><![CDATA[new Long(0)]]></defaultValueExpression>

</parameter>

<parameter name="toXY" class="java.lang.Long">

<parameterDescription><![CDATA[To XY]]></parameterDescription>

<defaultValueExpression><![CDATA[new Long(15L)]]></defaultValueExpression>

</parameter>

<parameter name="prm_companyUID" class="java.lang.Long">

<parameterDescription><![CDATA[Company UID]]></parameterDescription>

<defaultValueExpression><![CDATA[new Long(1L)]]></defaultValueExpression>

</parameter>

<parameter name="fromType" class="java.lang.Long">

<parameterDescription><![CDATA[From Type]]></parameterDescription>

<defaultValueExpression><![CDATA[new Long(600L)]]></defaultValueExpression>

</parameter>

<parameter name="toType" class="java.lang.Long">

<parameterDescription><![CDATA[To Type]]></parameterDescription>

<defaultValueExpression><![CDATA[new Long (600L)]]></defaultValueExpression>

</parameter>

<parameter name="prm_selection_formula" class="java.lang.String">

<parameterDescription><![CDATA[Additional elements to add to the Where clause]]></parameterDescription>

<defaultValueExpression><![CDATA[new String(" ")]]></defaultValueExpression>

</parameter>

<parameter name="prm_report_uid" class="java.lang.Long">

<parameterDescription><![CDATA[The report uid number referencing the properties file]]></parameterDescription>

<defaultValueExpression><![CDATA[new Long(4L)]]></defaultValueExpression>

</parameter>

<parameter name="prm_message_resources" class="java.lang.Object">

<parameterDescription><![CDATA[struts Message Resources]]></parameterDescription>

<defaultValueExpression><![CDATA[null]]></defaultValueExpression>

</parameter>

<parameter name="prm_locale" class="java.util.Locale">

<defaultValueExpression><![CDATA[java.util.Locale.getDefault()]]></defaultValueExpression>

</parameter>

<parameter name="prm_select_from" class="java.lang.String">

<defaultValueExpression><![CDATA[new String(" vxReportItemJoin ")]]></defaultValueExpression>

</parameter>

<parameter name="prm_pre_where" class="java.lang.String">

<parameterDescription><![CDATA[Additional where clause BEFORE the other WHERE]]></parameterDescription>

<defaultValueExpression><![CDATA[new String(" ")]]></defaultValueExpression>

</parameter>

<parameter name="prm_select_star" class="java.lang.String">

<parameterDescription><![CDATA[General value for the query]]></parameterDescription>

<defaultValueExpression><![CDATA[new String(" *, null as card_number ")]]></defaultValueExpression>

</parameter>

<parameter name="prm_order_by" class="java.lang.String">

<defaultValueExpression><![CDATA[new String(" category_uid, item_date ")]]></defaultValueExpression>

</parameter>

<parameter name="prm_report_name" class="java.lang.String">

<defaultValueExpression><![CDATA["Unnamed report"]]></defaultValueExpression>

</parameter>

<parameter name="prm_print_title_page" class="java.lang.Boolean">

<parameterDescription><![CDATA[if FALSE, do not print the title page]]></parameterDescription>

<defaultValueExpression><![CDATA[java.lang.Boolean.FALSE]]></defaultValueExpression>

</parameter>

<parameter name="prm_qry_xy_where" class="java.lang.String">

<defaultValueExpression><![CDATA[new String(" ")]]></defaultValueExpression>

</parameter>

 

-----

 

 

Recently, I upgraded to 0.6.1. I have no idea if that is relevent. I have not gone to read the code as of yet.

-----

 

I have a text field:

-----

<textField pattern="MM/dd/yyyy">

<reportElement positionType="Float" x="329" y="71" width="80" height="20"/>

<textElement textAlignment="Right"/>

<textFieldExpression class="java.util.Date">

<![CDATA[$P{fromDate}]]>

</textFieldExpression>

</textField>

--------

 

 

When I run the report, the map of parameters passed is :

-------

12:19:37,640 INFO [ReportServerAction] Parameters map = {prm_from_date=Sat May 01 00:00:00 CDT 2004, prm_to_xy=15, prm_print_title_page=true, prm_report_name=E

xpenses By Category, prm_to_type=600, prm_locale=en, prm_companyUID=1, prm_order_by=category_uid,item_date, prm_from_type=600, prm_report_uid=4, prm_from_xy=0,

prm_context_prefix=reports/, prm_message_resources={}, prm_to_date=Fri May 14 00:00:00 CDT 2004}

-------

 

As evidenced by this log, the start date is 2004-05-01 and the end date is 2004-05-14

 

As noted above, the textfield displaying fromDate should, according to this map, display

 

05/01/2004

 

Now, however, the field displays

 

12/31/1969

 

A similar field displays the toDate parameter.

 

That field displays

 

09/20/2004

 

instead of the expected

 

05/13/2004

 

 

--------------------------------------

 

It seems likely that there's some issue with dates involved :)

 

The parameters passed to the report do not seem to map to what actually is passed during the report fill. I've R'd the FM and found nothing that suggests that I might encounter such a problem. Likewise, I spent 10 minutes searching the forums.

 

Has anyone else had these issues or anything like them? As I said, this worked until quite recently but I have no clear picture of what code change (upgrading or my own code) caused it to fail.

 

 

 

 

 

 

 

 

By: Mykel Alvis - evilarchitect

RE: Possible Date evaluation issues

2004-09-20 10:43

Never mind. I'm a moron. I changed another report's parameters that are built using the same action and didn't rename them in all the reports that used those params. Now's the time on Sprockets when I feel like a dumbass.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...