Win a copy of Production-Ready Serverless (Operational Best Practices) this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

how to add row in display table using display tag?  RSS feed

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to add row in display table using display tag based on the calculation of previous row?
 
Bartender
Posts: 10759
68
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Happy S Singh wrote:how to add row in display table using display tag based on the calculation of previous row?


1. Get the previous row.
2. Do the calculation.
3. Add a new row with the result.

But I suspect that's not what you wanted to know. Please TellTheDetails (←click).

Winston
 
Happy S Singh
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am setting the values from resultset to formbean which is in turn used to display table on jsp

while(iResultSet1.next())
{
afWIPZonalRpt Objafwipzonalrpt = new afWIPZonalRpt();
Integer i=0;

Objafwipzonalrpt.setMis(iResultSet1.getString(++i));
Objafwipzonalrpt.setCentral(iResultSet1.getString(++i));
Objafwipzonalrpt.setEast(iResultSet1.getString(++i));
Objafwipzonalrpt.setFrontier(iResultSet1.getString(++i));
Objafwipzonalrpt.setNorth(iResultSet1.getString(++i));
Objafwipzonalrpt.setSouth(iResultSet1.getString(++i));
Objafwipzonalrpt.setSvv(iResultSet1.getString(++i));
Objafwipzonalrpt.setWest(iResultSet1.getString(++i));
Objafwipzonalrpt.setGrandTotal(iResultSet1.getString(++i));

expRptCol.add(Objafwipzonalrpt);
}

My question is how to get last two rows from the resultset, do the summation and add one more row at the bottom?
 
lowercase baba
Posts: 12734
51
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Get the 2nd to last row
2) Get the last row
3) Do the summation
4) add one more row.

Now, I'm going to go out on a limb, and guess that your question is REALLY: How do I know when I get to the last two rows?

you either need to query the result set to see how many rows there are ahead of time (I'm not sure if this is possible), or you need to save each row as it comes in. Then, when you get the next row, move the previous one up, and save this one...in other words, you have:

lastRowData;
secondLastRowData;

each time you read a row, you move what's in lastRowData to secondLastRow, and then store the current in lastRow.

you then have to account for the possibility that you have zero or one row, but that shouldn't be too hard.
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!