Skip to main content



      Home
Home » Archived » BIRT » Problem with date and sql statement / filter
Problem with date and sql statement / filter [message #55557] Sat, 09 July 2005 08:00 Go to next message
Eclipse UserFriend
Originally posted by: birgit.dippelreiter.promac.at

Hi!

I have a problem with my select statement. I select all entries from a
database which are between two dates; but in the sql statement the
where-clause didnŽt work. So I gave the dates to the filter and now it
works.
Now my problem is, that the two dates have to be flexible parameters so
that every user can insert different dates. But I only get errors when I
set parameters for the dates.
Does anyone know what I did/do wrong?
Or does anyone know how I have to do?

Thanks
Birgit
Re: Problem with date and sql statement / filter [message #55612 is a reply to message #55557] Sat, 09 July 2005 10:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.none.none

Hi Birgit,
I seem to have a lot of date parameter issues as well. Here are a few
things that I did, that you can try to get it working at least temporarily.
I don't think this is the 'correct' approach, but as responses in this group
are few and far between, I figure this might at least get you going until we
get the 'right' answer....

- First of all, use the "?" notation in the SQL query where you want the
dates.
- In your data set definition add a corresponding parameter for each date.
- Add a default date to each one. The default format for BIRT is like
this,"01/30/2005 00:00:00 AM", for example (make sure you put the quotes
around it).
- Create a corresponding number of Report Parameters. When I created the
report parameters as Date parameters, I had problems... BIRT kept
complaining that it couldn't create a java.util.Date from my params. So my
temporary (hopefully) workaround has been to define my report params as
String. Then things work just fine. The obvious down-side to that, is that
if you use the built-in interface for user-input, there'll be no validation
for date patterns because BIRT doesn't know what to expect.

I had a similar issue when trying to link to tables by date parameters. I
had to create a string representation of my dates in the query as a separate
column and then link on those in BIRT. Either BIRT has some nasty Date
issues, or I'm going about it all wrong... but I am at least running for the
time being. Hopefully somebody in the group will speak up with more
definitive info.

I'm using 1.0.1 M1.

Good luck.



"Birgit" <birgit.dippelreiter@promac.at> wrote in message
news:c86196e53baee61bd96b1844bcd7cd43$1@www.eclipse.org...
> Hi!
>
> I have a problem with my select statement. I select all entries from a
> database which are between two dates; but in the sql statement the
> where-clause didn
Re: Problem with date and sql statement / filter [message #55746 is a reply to message #55612] Sun, 10 July 2005 08:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: birgit.dippelreiter.promac.at

Hi!

Thanks!
I already work with paramaters in my SQL statement (and "?" Notation) and
for the other fields in my SQL query it works fine.
When I tried to set the "?" Notation for date fields in my query and
configured parameters with date I got the same errors like you.
So I tried to format the parameters as string, but then I got the error

"There are errors on the report page:
Error1:Bei der Datentypkonversion ist ein Fehler aufgetreten.
Kann nicht in Date umgewandelt werden."

It says that the type conversion failed.

Would it be possible to take the "?" Notation in the filter?

Thanks,
Birgit
Re: Problem with date and sql statement / filter [message #55797 is a reply to message #55746] Mon, 11 July 2005 01:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.none.none

Hi Birgit,
Sorry if you already know this, but just to make sure we're talking about
the same thing...
There's are two sets of parameters you would need to configure if you want
the user to be able to enter start/end dates.
One set is on the dataset itself. The second set is on the report (this is
what causes BIRT to prompt the user for parameters). Then you link these two
sets of parameters (report parameters to dataset parameters). So, in my
case I have dataset parameters as Dates and the report parameters as
Strings. It doesn't make much sense to me, but it's what works right now ;)

Is this what you did?



"Birgit" <birgit.dippelreiter@promac.at> wrote in message
news:d837025cebf6c8ab6daca131f7ddc9e2$1@www.eclipse.org...
> Hi!
>
> Thanks! I already work with paramaters in my SQL statement (and "?"
> Notation) and for the other fields in my SQL query it works fine.
> When I tried to set the "?" Notation for date fields in my query and
> configured parameters with date I got the same errors like you.
> So I tried to format the parameters as string, but then I got the error
>
> "There are errors on the report page:
> Error1:Bei der Datentypkonversion ist ein Fehler aufgetreten.
> Kann nicht in Date umgewandelt werden."
>
> It says that the type conversion failed.
>
> Would it be possible to take the "?" Notation in the filter?
>
> Thanks,
> Birgit
>
>
>
Re: Problem with date and sql statement / filter [message #55984 is a reply to message #55797] Mon, 11 July 2005 12:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: birgit.dippelreiter.promac.at

Hi!

Yes, this is what I did, and it doesnŽt work.
But I think my problem is that if I put the start/end date in my sql query
it doesnŽt work; the sql query selects all datasets.
When I put the begin/end date in the filter, it only selects the datasets
between the dates.
So whatŽs wrong?
I tried (hopefully) all possible dateformats in the sql query!

Thanks,
Birgit
Re: Problem with date and sql statement / filter [message #56405 is a reply to message #55984] Tue, 12 July 2005 02:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.none.none

Ok, sorry, I think I misunderstood before. The problem is not error
messages anymore, the problem is that it's not filtering data based on dates
through SQL. I'm not sure what the problem is (I've only been using BIRT
for about a week, so I'm a newbie as well)... but I do have a few
suggestions you can try in case you haven't done so already..

When you put parameters on a dataset, you have to put in default values. Do
your default values work correctly? If your dataset preview is returning
all data regardless of what you put as default values in your dataset
parameters, then I would suspect maybe your SQL is not set up correctly. If
it does filter data correctly when you use preview (which utilizes the
default values), but not when you do manual data entry through the client
interface, then I would suspect that your report parameters are not linked
correctly to your dataset parameters.
One thing that would help you narrow down the problem is turning on SQL
tracing in your database and inspect the actual query that is being executed
on the server.... see what date values are being requested by BIRT.

That's about all I can think of right now... hopefully that helps a little.


"Birgit" <birgit.dippelreiter@promac.at> wrote in message
news:32cb4aef3fc217110def55e225270242$1@www.eclipse.org...
> Hi!
>
> Yes, this is what I did, and it doesn
Re: Problem with date and sql statement / filter [message #56938 is a reply to message #55984] Tue, 12 July 2005 14:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I think that you have problem with formating parameter.
I also built report with 'where' on date field and it didn't work (it was
with Oracle DB). At the begining I used parameters as Date Time. And when I
had clause:
where <date> between ? and ? order by <date>
it didn't work in Preview Results and of course in report.
When I changed it to
where <date> <= ?
everything it was better.
I check on DB - SQL was in both cases OK.
So I start to check different format of param. My normal format of date is
DD/MM/YYYY and I used it during a preview. But when I changed it to
YYYY-MM-DD everything started to work: on Preview Result data was correct
and on Report Preview also, even when parameter is defined as Any.

Maybe it will help you.

Anak


Uzytkownik "Birgit" <birgit.dippelreiter@promac.at> napisal w wiadomosci
news:32cb4aef3fc217110def55e225270242$1@www.eclipse.org...
> Hi!
>
> Yes, this is what I did, and it doesn
Re: Problem with date and sql statement / filter [message #57380 is a reply to message #56938] Wed, 13 July 2005 04:48 Go to previous message
Eclipse UserFriend
Originally posted by: birgit.dippelreiter.promac.at

Hi!

I solved the problem. The database is inconsistant in formatting dates.
There are different formats how the date is in the database. So I had to
change the format in the sql query and now it works.
About the problem with the paramters. I formatted the date parameters(in
the sql parameter and the reportparameter) as string and it works.

So thanks a lot!

Birgit
Previous Topic:Desgin Engine API : help, doc, or something else ...
Next Topic:Problem with BIRT script
Goto Forum:
  


Current Time: Sat May 10 02:08:12 EDT 2025

Powered by FUDForum. Page generated in 0.04832 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top