on 08-18-2004 5:28 PM
Anyone could help me?
After uploading a CSV file, parsing it with StringTokenizer and displaying it in a table, how can i catch a value of a cell so to compare it to another?
Thanks
PS: I heard something about comma separated list. What´s the diference between this and comma separated values?
Hi,
If you could help me with another thing. how can i make the addiction of various values of a columm, that I get from the tableview?
eg. I would like to present in a textarea(for example) the total of my frist columm.
I´m going to that a look at the reward point´s again!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could do something like
<code>
try{
int value1 = java.lang.Integer.parseInt(TableView.getValueAt(<row>,<column>).getValueAsString());
int value2 = java.lang.Integer.parseInt(TableView.getValueAt(<row>,<column>).getValueAsString());
int newValue = value1 + value2;
}
catch(NumberFormatException e){
//Do Something as the value in the string is not a number
}
</code>
I hope this helps
D
Hi,
with the help of a friend, my code...
int total = 0;
for(int i =1; i<=tabResultado.getRowCount();i++) {
String s = tabResultado.getValueAt(i,"Valor Monetário").getValueAsString();
int parcela = 0;
try{
parcela = new Integer(s).intValue();
}catch(Exception e){}
total = total + parcela;
}
the problem is that it only "catches" values like 1;2;3 and not 1.4;0.4.
Can you help me?
Hi Virginia,
maybe it's a very stupid answer, but why don't you try with something like this?
float total = 0;
for(int i =1; i<=tabResultado.getRowCount();i++) {
String s = tabResultado.getValueAt(i,"Valor Monetário").getValueAsString();
float parcela = 0;
try{
parcela = new Float(s).floatValue();
}catch(Exception e){}
total = total + parcela;
}
Cheers
Roberto
If you are using the TableView HTMLb element then you can use the getValueAt(int row, String columnName) method, if you are using the HTML table, i.e. <tr><td></td></tr>, then you would have to assign ids or names to the tags and use javascript to compare the values.
A comma separated list is basically the same as the CSV file as far as I am aware and would be processed in the same way.
I hope this helps
Darrell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.