Jump to content
Changes to the Jaspersoft community edition download ×

sysdate??


marianela

Recommended Posts

Hi all,

I have a question, I need to catch the actual date . Can I use sysdate?...

 

I mean, I need to include sysdate in a SQL statement...

 

My sql is like...

 

***select decode(fac.tipo_factura, 'P', fac.id_prev, fac.no_factura) no_factura,

fac.id_servicio, srv.descripcion, fac.fecha_recibo, fac.tipo_factura, fac.id_cliente, clie.nombre,

fac.periodo, fac.periodo_contable,fac.fecha_ini_servicio, fac.duracion_servicio, fac.fecha_caducidad,

decode(fac.factura_pagada,'S','SI','N','NO','P','PP','E','SP') pagado, fac.fecha_pago,

decode($P{p_moneda},'B', nvl(decode(fac.tipo_factura, 'P', monto_bs_prev, monto_bs),0), nvl(decode(fac.tipo_factura, 'P', monto_us_prev, monto_us),0)) monto_cobrar,

0 monto_pagado, fac.id_prev, '' periodo_ref, fac.id_documento

from con_facturas fac, con_servicios srv, con_clientes clie

where to_char(fac.id_cliente) = $P{p_cliente}

and (fac.id_servicio = $P{p_servicio} or $P{p_servicio} = 0)

and fac.periodo >= $P{p_periodo} and fac.periodo <= $P{p_periodofin}

and ((fac.factura_pagada in ($P{p_deuda},$P{p_deuda1}) or $P{p_deuda} = 'T') or ($P{p_deuda} = 'M' and sysdate > fac.fecha_caducidad and fac.factura_pagada = 'N'))

and fac.tipo_cuenta = 'C'

and fac.id_servicio = srv.id_servicio

and (fac.tipo_factura = $P{p_tipof} or fac.tipo_factura = $P{p_tipop} or fac.tipo_factura = $P{p_tipoc})

and fac.id_cliente = clie.id_cliente***

............

 

But when I try to run the report I obtain some error like...

it.businesslogic.ireport.ReportClassLoader@c84054 net.sf.jasperreports.engine.JRException:ÂErrorsÂwereÂencounteredÂwhenÂcompilingÂreportÂexpressionsÂclassÂfile: 1.ÂCannotÂcastÂfromÂDateÂtoÂString ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂvalueÂ=Â(java.lang.String)(newÂjava.util.Date()); ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<--------------------------------------> 2.ÂCannotÂcastÂfromÂDateÂtoÂString ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂvalueÂ=Â(java.lang.String)(newÂjava.util.Date()); ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<--------------------------------------> 3.ÂCannotÂcastÂfromÂDateÂtoÂString ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂvalueÂ=Â(java.lang.String)(newÂjava.util.Date()); ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<--------------------------------------> 3Âerrors

 

What am I doing wrong???

I think that maybe sysdate is not correct in IReports 1.2.7, if so, what coul I use to get the actual date?

Pleasee I really need help¡¡¡¡

Thanks for all...:)

 

Regards....

Post edited by: marianela, at: 2007/01/31 15:32

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi, I'm not sure if this is exactly what's happening to you, but when I've an error like that is almost always because I've a text field with a variable (or field or parameter) of a type (java.util.Date in your case) and the text field expression class is set to java.lang.String.

try change it to java.util.Date.

 

HTH

Link to comment
Share on other sites

Dear EuzkoArima,

 

Thanks a lot for your answer, it really help to resolve my problem...

It was what you said, I didn't realize that I have some fields of an incorrect type... :blush:

 

Thanks a lot again¡¡¡

Have a nice day,

Regards,

Marianela

;)

Post edited by: marianela, at: 2007/02/01 12:22

Link to comment
Share on other sites

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