Jump to content
We've recently updated our Privacy Statement, available here ×

Date Parameter with SQL Methode for OpenERP Report


ibradien

Recommended Posts

I am creating a report using iReport Designer for OpenERP, with sql method and parameters ( $P{start_date} and $P{end_date} ).

Report contains main report and sub reports (2), and sql methods applied in the sub reports.

Main report was given 2 parameters :

1. $P{start_date}, Parameter Class --> java.util.Date, Use as a prompt : TRUE

2. $P{end_date}, Parameter Class --> java.util.Date, Use as a prompt : TRUE

Sub Reports was given 2 parameters :

1. $P{start_date}, Parameter Class --> java.util.Date, Use as a prompt : TRUE

2. $P{end_date}, Parameter Class --> java.util.Date, Use as a prompt : TRUE

sub reports execute the following SQL syntax: 

SELECT a.name AS kode_jb, a.deskripsi AS jns_blnja, b.tgl_transaksi, b.output

FROM jenis_belanja a JOIN transaksi_bos b ON a.id=b.jns_belanja

WHERE b.tgl_transaksi BETWEEN $P{start_date} AND $P{end_date}

after I apply reports to OpenERP,  result is that there is an error warning: 

Failed to invoke method execute in class com.nantic.jasperreports.JasperServer: Error evaluating expression : 

Source text : $P{end_date} "
I do have an alternative way to add a third parameter ( $P{date_token}, Parameter Class --> java.util.String, Use as a prompt : FALSE and default value expression --> ($P{start_date} == null || $P{end_date} == null ? "AND 0=0" :
"AND b.tgl_transaksi BETWEEN '" + new SimpleDateFormat("yyyy-MM-dd").format($P{start_date}) + "' AND '" + new SimpleDateFormat("yyyy-MM-dd").format($P{end_date}) +"'" ). )
but the same error warning appears: Failed to invoke method execute in class com.nantic.jasperreports.JasperServer: Error evaluating expression : 
Source text : $P{end_date}.
anyone can help me find a solution ?
 
Thanks
Baim
 
nb : sorry, my english is not perfect.

 

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