on 01-12-2009 11:19 AM
Hi,
I want to put the value which i retrieve from one SQL table to the Table UI element which i created in application. I have done Create Binding to the table also with context attribute And set the out put of that ResultSet to the particular context element also. Still i am not able to display the value in the table can any one help me Please.
Regards,
H.V.Swathi
plz post code.
are you filling the context on initialization?
nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes i am fillingg it in wdInit() method
CallableStatement cs1=con.prepareCall("{call Usp_TimeSheetList(?,?,'development',0)}");
wdComponentAPI.getMessageManager().reportSuccess("00date");
cs1.setDate(1,date2);
wdComponentAPI.getMessageManager().reportSuccess("00date date"+date2);
cs1.setInt(2,id);
wdComponentAPI.getMessageManager().reportSuccess("00date id"+id);
cs1.execute();
ResultSet rsDate = cs1.executeQuery();
while(rsDate.next())
{
String dateString=rsDate.getString(1);
wdComponentAPI.getMessageManager().reportSuccess("00date"+dateString);
Date today = df.parse(dateString);
wdComponentAPI.getMessageManager().reportSuccess("00date"+today.toString());
java.sql.Date datepass =new java.sql.Date(today.getTime());
wdComponentAPI.getMessageManager().reportSuccess("00date"+datepass.toString());
wdContext.currentPersonalDataElement().setMyDate(datepass);
wdContext.currentPersonalDataElement().setHrsWorked(rsDate.getFloat(7));
wdComponentAPI.getMessageManager().reportSuccess("00date"+rsDate.getFloat(7));
wdContext.currentPersonalDataElement().setHolidays(rsDate.getString(13));
wdComponentAPI.getMessageManager().reportSuccess("00date"+rsDate.getString(13));
}
//String querry="select * from tbltimesheet where Emp_id=? and Tmsht_Submtdate=?";
}
Edited by: H.V Swathi on Jan 12, 2009 12:31 PM
the following code is to create table node element for each result (row) from database
CallableStatement cs1=con.prepareCall("{call Usp_TimeSheetList(?,?,'development',0)}");
//wdComponentAPI.getMessageManager().reportSuccess("00date");
cs1.setDate(1,date2);
//wdComponentAPI.getMessageManager().reportSuccess("00date date"+date2);
cs1.setInt(2,id);
//wdComponentAPI.getMessageManager().reportSuccess("00date id"+id);
//cs1.execute();
ResultSet rsDate = cs1.executeQuery();
IPrivate<CompName>.IPersonalDataElement pel;
while(rsDate.next())
{
String dateString=rsDate.getString(1);
//wdComponentAPI.getMessageManager().reportSuccess("00date"+dateString);
Date today = df.parse(dateString);
//wdComponentAPI.getMessageManager().reportSuccess("00date"+today.toString());
java.sql.Date datepass =new java.sql.Date(today.getTime());
//wdComponentAPI.getMessageManager().reportSuccess("00date"+datepass.toString());
pel = wdContext.createPersonalDataElement();
pel.setMyDate(datepass);
pel.setHrsWorked(rsDate.getFloat(7));
wdContext.nodePersonalData().addElement( pel);
//wdComponentAPI.getMessageManager().reportSuccess("00date"+rsDate.getFloat(7));
//wdContext.currentPersonalDataElement().setHolidays(rsDate.getString(13));
//wdComponentAPI.getMessageManager().reportSuccess("00date"+rsDate.getString(13));
}
//String querry="select * from tbltimesheet where Emp_id=? and Tmsht_Submtdate=?";
}
}
Edited by: Nikhil Bose on Jan 12, 2009 5:08 PM
Hi,
I am able to fetch the data through this code only only the last row can be placed in the table.
code is
String dateString=rsDate.getString(1);
wdComponentAPI.getMessageManager().reportSuccess("dateString"+dateString);
Date today = df.parse(dateString);
wdComponentAPI.getMessageManager().reportSuccess("today.toString()"+today.toString());
java.sql.Date datepass =new java.sql.Date(today.getTime());
wdComponentAPI.getMessageManager().reportSuccess("datepass.toString()"+datepass.toString());
wdContext.currentPersonalDataElement().setMyDate(datepass);
wdComponentAPI.getMessageManager().reportSuccess("getMyDate11111"+wdContext.currentPersonalDataElement().getMyDate());
wdContext.currentPersonalDataElement().setHrsWorked(rsDate.getFloat(7));
wdComponentAPI.getMessageManager().reportSuccess("getHrsWorked1111"+wdContext.currentPersonalDataElement().getHrsWorked());
wdContext.currentPersonalDataElement().setHolidays(rsDate.getString(13));
wdComponentAPI.getMessageManager().reportSuccess("getHolidays"+wdContext.currentPersonalDataElement().getHolidays());
Do i need to put this in any for loop.
can any one help me in this.
Regards,
H.V.Swathi
Edited by: H.V Swathi on Jan 12, 2009 1:44 PM
Hi Swathi,
Have you checked you are getting Values from ResultSet by printing the Values.
If yes then please check the steps to assign the result of resultset to the table columns.
1. you can add the resultset value to array List.
2. create the object of Table Node like
IPrivateTestTaxonomyView.IVn_LastLevelElement ele=null;
3.Now inside a for loop which is from zero to size of arraylist initialize the table node like ele = wdContext.nodeVn_LastLevel().createVn_LastLevelElement();
4. Now you can set the values fropm the arraylist to table columns like.
for(int j=0;j<abc.size();j++){
ele = wdContext.nodeVn_LastLevel().createVn_LastLevelElement();
ele .setVa_Column1(abc.get(j).toString());
ele .setVa_Column2(abc.get(j).toString());
wdContext.nodeVn_LastLevel().nodeVn_Attributes().addElement(ele );
}
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.