Calendar date

I am developing a report where there are two dates ->from date and to date,based on which the underlying table gets populated with the data.

I am getting the two dates from the two calendar components and then I am converting the dates into sql date which I am passing by setobject to the query editor.

The dates that I am passing are ok.The query in the query editor runs properly.

But the table doesn't get populated with any new data based on the selection.

Can anybody tell me what can be the reason?

Please help me.It is very very urgent.

[584 byte] By [Sheen] at [2007-11-26 11:01:49]
# 1

hi,

if u have binded the table component with an ordinary data provider then check whether u have given a code similar to this in the button_action method:

yourDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{Ses sionBean1.yourRowSet}"));

yourDataProvider and yourRowSet refers to the dataprovider and the rowset which u have binded with the table.

otherwise if u have binded the table with objectListDataProvider u need to add the following:

getSessionBean1().setyourListDataProvider(new yourReportListDataProvider(lst));

your table component should be binded to yourListDataProvider.In the above code you are setting that ObjectListDataProvider with a List list that contains the values to be displayed in the table.

rpk@trat at 2007-7-7 3:15:31 > top of Java-index,Development Tools,Java Tools...
# 2

The following is the code that I am using :

java.util.Date Dt1=calendar1.getSelectedDate();

long Dt1_lng=Dt1.getTime();

java.sql.Date Dt1_sql=new java.sql.Date(Dt1_lng);

java.util.Date Dt2=calendar2.getSelectedDate();

long Dt2_lng=Dt2.getTime();

java.sql.Date Dt2_sql=new java.sql.Date(Dt2_lng);

getSessionBean1().getmyRowSet().setObject(1,Dt1_sql);

getSessionBean1().getmyRowSet().setObject(2,Dt2_sql);

myDataProvider.commitChanges();//This is the data provider that I ambinding with my table component.

myDataProvider.refresh();

Query in myRowSet is:

SELECT * from tbl where TO_CHAR(tbl.ODATE,'yyyy-mm-dd') BETWEEN ? AND ?

What is wrong out here?

I tried to debug but there is no error also.

Please help!

Sheen at 2007-7-7 3:15:31 > top of Java-index,Development Tools,Java Tools...
# 3
which Database are u using.
rpk@trat at 2007-7-7 3:15:31 > top of Java-index,Development Tools,Java Tools...
# 4
oracle 9i
Sheen at 2007-7-7 3:15:31 > top of Java-index,Development Tools,Java Tools...
# 5
try this,change the date format in the query with the following:'yyyy-MM-dd'Also ensure that there is data in the database with the provided datescheers,rpk
rpk@trat at 2007-7-7 3:15:31 > top of Java-index,Development Tools,Java Tools...