#1 2015-04-14 18:13:37

Al3tz
Member
Registered: 2015-04-04

Issue on Paramater Date

Hi everyone,
When i configure a report to use parameter of type date, parameter is send in the form '2015-04-14 -05:00:00', even if parameter is setup as date.
If try use formula in the form ${today} result is the same.
If try use formula in the form ${today.format(****)}, parse throw error.

It's is a bug ??

Regards

Offline

#2 2015-04-14 18:31:42

Arno Mittelbach
datenwerke
Registered: 2012-02-14

Re: Issue on Paramater Date

Hi,

the date parameter returns a Date object. If you have a column datecol of type DATE (or akin) and a date parameter with key date you should be able to use it as

SELECT * FROM MY_TABLE WHERE datecol < ${date}

Beware that the date object will come with minutes and seconds and thus a comparison usually needs to use date/time functions. Also, if the column that you are
testing against is not of type date but say a string of format YYYYMMDD then you would need to use a database date function to convert the date
into a string. Using format(**) in this case is not supported.

How are you currently using the parameter? Could you provide an example?

Cheers
-Arno

Offline

#3 2015-04-14 18:40:44

Al3tz
Member
Registered: 2015-04-04

Re: Issue on Paramater Date

Hi,
format(**) is only to illustrate, format needed is format("yyyy-MM-DD").

When i try cast using function of Postgresql, an error is thrown.

Ex.
SELECT to_char(DATE ${day}, 'YYYY-MM-DD'), show error

**I understand that if, i  set as type date, only part of the year, month, day should be returned by the object today.

Offline

#4 2015-04-14 20:28:04

Arno Mittelbach
datenwerke
Registered: 2012-02-14

Re: Issue on Paramater Date

Hi,

your SQL is wrong. What you would need here is something like:

SELECT to_char(${day}::date, 'YYYY-MM-DD') AS A

Cheers
-Arno

Offline

#5 2015-04-15 16:35:24

Al3tz
Member
Registered: 2015-04-04

Re: Issue on Paramater Date

Hi Arno,
You are right.
Thanks

Offline

Board footer

Powered by FluxBB