craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > General QuickTable Support/Help Post New Topic   Post A Reply
setValueAt(....) problem printer friendly version
next newest post | next oldest post
Author Messages
nick
Private

Gender: Male
Location: Greece
Registered: Apr 2007
Status: Offline
Posts: 4

Click here to see the profile for nick Send email to nick Send private message to nick Find more posts by nick Edit or delete this message Reply w/Quote
Posted Sunday, April 15, 2007 @ 17:27:49  

Hello,
I have 7 columns from a database and they are ok. And i want to add a column "stock" to show the value col6- col7. The problem is that the
column "stock" is empty... I'm using the latest version and there are no exceptions. Here is the code:
Column stock=new Column(8,"Stock");
stock.setType(java.sql.Types.INTEGER);
dBTable1.addColumn(stock);
dBTable1.refresh();
stock.setPreferredWidth(40);
for(int i=0;i<dBTable1.getRowCount();i++ ){
java.math.BigDecimal ad= (BigDecimal) dBTable1.getValueAt(i, 5);
Integer a=ad.intValueExact();
java.math.BigDecimal ab=(java.math.BigDecimal) dBTable1.getValueAt(i, 6);
Integer b=ab.intValueExact();
Integer stockVal=a-b;
dBTable1.setValueAt(stockVal,i,7);//It doesn't seem to work
}
dBTable1.refresh();
this.add(dBTable1,"Center");

Thank you

[Edit by nick on Sunday, April 15, 2007 @ 19:58:51]

nick
Private

Gender: Male
Location: Greece
Registered: Apr 2007
Status: Offline
Posts: 4

Click here to see the profile for nick Send email to nick Send private message to nick Find more posts by nick Edit or delete this message Reply w/Quote
Posted Sunday, April 15, 2007 @ 17:35:53  

I added System.out.println and i am getting the right results but i can not see them in dBTable1...
....
Integer stockVal=a-b;
dBTable1.setValueAt(stockVal,i,7);
System.out.println((Integer)dBTable1.getValueAt(i,7));//values are ok
}
....
Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Tuesday, April 17, 2007 @ 05:25:54  

Please read carefully the API instructions for addColumn

Also read the following discussion
http://quicktable.org/discussion/cutecast/cutecast.pl?forum=11&thread=395

Also enable debug using dbtable.debug=true; this will show you all the debug messages.

In your code, I see that you call refresh() method after adding a column, which is not correct.

nick
Private

Gender: Male
Location: Greece
Registered: Apr 2007
Status: Offline
Posts: 4

Click here to see the profile for nick Send email to nick Send private message to nick Find more posts by nick Edit or delete this message Reply w/Quote
Posted Tuesday, April 17, 2007 @ 13:45:28  

Thank you very much for your help :) . I shouldn't call refresh() method after adding a column.

[Edit by nick on Tuesday, April 17, 2007 @ 13:46:46]

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios