Announcement

Migration of this forum

Dear users of this forum,

we are pleased to inform you that we will be updating the software behind this forum in the near future.

Existing posts, users and categories will remain untouched.

Important:

  • Each user will need to reset their password.
  • Please select "I forgot my password".
  • Enter the email address you used to register in this forum.
  • You will receive an email with a link to set a new password.
  • Please choose a new (secure) password and confirm the process.

We will keep you informed in the pinned thread.

Kind regards,
Your ReportServer Team


Migration des Forums

Liebe Nutzer dieses Forums,

wir freuen uns, euch mitteilen zu können, dass wir in naher Zukunft die Software hinter diesem Forum aktualisieren werden.

Existierende Beiträge, Nutzer und Kategorien bleiben weiterhin bestehen!

Wichtig:

  • Jeder Nutzer muss sein Passwort neu vergeben.
  • Wählt dazu einfach "Ich habe mein Passwort vergessen".
  • Gebt die E-Mail-Adresse ein, mit der ihr registriert seid.
  • Ihr erhaltet eine E-Mail mit einem Link zur Passwortvergabe.
  • Bitte wählt ein neues (sicheres) Passwort und bestätigt den Vorgang.

Wir halten euch im angepinnten Beitrag auf dem Laufenden!

Mit vielen Grüßen
Euer ReportServer Team

#1 2016-11-09 09:27:56

nprokofiev
Member
Registered: 2016-11-09

Trimming time issue

Hi. When I pass datetime parameter to report, time is being trimmed and mysql executes query without time. Is it a bug or misconfiguration?

Offline

#2 2016-11-17 09:06:05

kingjack
Member
Registered: 2016-11-17

Re: Trimming time issue

I think it is misconfiguration

Offline

#3 2016-11-17 09:20:04

nprokofiev
Member
Registered: 2016-11-09

Re: Trimming time issue

Thanks for reply.
What is the right way to to do it? Every time I execute
select * from TableA where dateColumn1 between ${dateFrom} and ${dateTo}
I see in mysql logs that time is trimmed.
dateFrom and dateTo parameters are in "Date and Time" mode.

Offline

#4 2017-03-03 12:02:35

IF_Eduardo
Administrator
Registered: 2016-11-01
Website

Re: Trimming time issue

Hi nprokofiev,

we are investigating this issue. Please take a look here: https://forum.reportserver.net/viewtopic.php?id=631 and check if the workaround works for you.

Cheers,
Eduardo

Offline

#5 2017-05-16 12:07:00

IF_Eduardo
Administrator
Registered: 2016-11-01
Website

Re: Trimming time issue

For completeness:

I took a look at this issue and it seems the standard jasper behavior, not a reportserver bug.
Reportserver passes the parameter as java.util.Date to jasper. It passes the *complete* java.util.Date to jasper, including the time component. For checking this, you can write $P!{param1} in your query (instead of $P{param1}), and check what is arriving at the database. It should be something similar to: 'Wed Mar 29 09:44:07 CEST 2017'.
Jasper seems to cut the time component when having a java.util.Date parameter in its query, take a look at http://community.jaspersoft.com/questio … -textfield for a similar issue. When having java.sql.Timestamp, this is not happening. So the "workaround" above is the correct solution.
Here the steps:
1. Create a java.util.Date parameter "param1" with isForPrompting=true
2. Create a java.sql.Timestamp parameter "param1_sql" with isForPrompting=false, and defaultValue=new java.sql.Timestamp($P{param1}.getTime())
3. Use the "param1_sql" parameter in your query, e.g.: select * from mytable where myfield < $P{param1_sql}.
The time component is not being cut anymore.

Cheers,
Eduardo

Offline

Board footer

Powered by FluxBB