Jump to content
JasperReports Library 7.0 is now available ×

How to create relative date parameters for Domain


terry.davis

Recommended Posts

I need to create a relative date parameter in Jaspersoft Studio 6.2.  I am using a domain and not a SQL data source.

I have googled "jaspersoft studio domain relative date" and searched for "domain relative date" in the community wiki.

The "best" results that I have found are listed below.


Unfortunately, all reference a SQL data source.  For example:
<querystring>
    <!--[CDATA[select * from test_table where $X{EQUAL, orderDate, dateRange}]]-->
</querystring>


Below you will find my:

  • parameter:  dateRange
  • queryField: dbo_RPT_OpportunityDeNorm.OpenDate
  • field: dbo_RPT_OpportunityDeNorm.OpenDate


    <parameter name="dateRange" class="net.sf.jasperreports.types.date.TimestampRange">
        <defaultValueExpression><![CDATA[new net.sf.jasperreports.types.date.DateRangeBuilder("WEEK-52").set(java.sql.Timestamp.class).toDateRange()]]></defaultValueExpression>
    </parameter>
    <queryString language="domain">
        <![CDATA[<query>
            <queryFields>
                <queryField id="dbo_RPT_OpportunityPracticeGroup.PracticeGroup_Name"/>
                <queryField id="dbo_RPT_OpportunityDeNorm.OpenDate"/>
                <queryField id="dbo_RPT_OpportunityDeNorm.OpportunityOutcome"/>
            </queryFields>
            <queryFilterString>dbo_RPT_OpportunityDeNorm.StatusLabel == 'Closed'</queryFilterString>
        </query>]]>
    </queryString>

    <field name="dbo_RPT_OpportunityDeNorm.OpenDate" class="java.sql.Timestamp">
        <fieldDescription><![CDATA[Open Date]]></fieldDescription>
    </field>


What I don't understand is how to add the following condition:  $X{EQUAL,dbo_RPT_OpportunityDeNorm.OpenDate,dateRange}

Thank you for your assistance.

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...