473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How i will display the total value in my code.

Dear Sir,
In my develpment i am getting stuck for a senario.Kindly please help me for it.

Everytime we give the request we get the response of 8 records and
its corresponding value.
Then next button will display more and more records if it is availbale in data base.

I am attachcing the screen shoot of my problem

CMP is a column in the this record.

i want to calculate all the CMP value which displyed in total pages
and its value will populate in Total =<%TotalCMP%>

Let say in the first page i get 8 records then .Then CMP value in the
page1total=200+100+20+1+1+1+1+1

page2total=page1total+(8 filed data of page 2 in cmp)

if page is the final page of record
then page3finalcmptotal=page1total+page2total+(8 filed data of page 2 in cmp)

Total will papulate Total CMP =<%TotalCMP%> (PAGE NO ARE DYMANIC)


Please look my code and guide me how i will display Total CMP Value.
For(int iCount=0;iCount < iNoOfRec;iCount++ )
{



%>
<TR >
<%
if (iCount==0)
{
%>
<TD align ="right"><INPUT TYPE="radio" id ="selOption" NAME="selOption" VALUE="<%=iCount%>" ONFOCUS="activateFields('<%=iCount%>');" CHECKED > </TD>
<%
}
else
{
%>
<TD align ="right"><INPUT TYPE="radio" id ="selOption" NAME="selOption" VALUE="<%=iCount%>" ONFOCUS="activateFields('<%=iCount%>');"> </TD>
<%
}//else closes

if (dbflag==0)
{
inVec= (Vector) vData.elementAt(iCount);

%>
<TD align ="right"><INPUT TYPE="text" maxlength ="30" size="30" NAME="Symbol<%=iCount%>" class = "textDataCell" DISABLED VALUE="<%=(String) inVec.elementAt(0)%>">
<TD align ="right"><INPUT TYPE="text" maxlength ="12" size="12" NAME="ISIN<%=iCount%>" class = "textNumericCell" DISABLED VALUE="<%=(String) inVec.elementAt(1)%>"></TD>
<TD align ="right"><INPUT TYPE="text" maxlength ="6" size="6" NAME="FB<%=iCount%>" class = "textNumericCell" DISABLED VALUE="<%=(String) inVec.elementAt(2)%>"></TD>

<TD align ="right"><INPUT TYPE="text" maxlength ="6" size="6" NAME="CMP<%=iCount%>" class = "textNumericCell" DISABLED VALUE="<%=(String) inVec.elementAt(3)%>">
<TD align ="right"><INPUT TYPE="text" maxlength ="6" size="6" NAME="CMV<%=iCount%>" class = "textNumericCell" DISABLED VALUE="<%=(String) inVec.elementAt(4)%>"></TD>

<TD align ="right"><INPUT TYPE="text" maxlength ="6" size="6" NAME="UP<%=iCount%>" class = "textNumericCell" DISABLED VALUE="<%=(String) inVec.elementAt(5)%>">
<TD align ="right"><INPUT TYPE="text" maxlength ="6" size="6" NAME="OH<%=iCount%>" class = "textNumericCell" DISABLED VALUE="<%=(String) inVec.elementAt(6)%>"></TD>
<TD align ="right"><INPUT TYPE="text" maxlength ="6" size="6" NAME="AvlQtyForHold<%=iCount%>" class = "textNumericCell" DISABLED VALUE="<%=Float.parseFloat((String)inVec.elementAt (2))-Float.parseFloat((String)inVec.elementAt(3))-Float.parseFloat((String)inVec.elementAt(4))%>"></TD>
<TD align ="right"><INPUT TYPE="text" maxlength ="6" size="6" NAME="QtyForHold<%=iCount%>" onkeypress="return numbersonly()" onKeyDown="return validateOnKeyDown()" onBlur="validateNumber(this.value,this,'Quantity') " class = "textNumericCell"></TD>

<INPUT TYPE="hidden" NAME="Agency<%=iCount%>" VALUE="E"></TD>
if(sCurPageNo.equals(sTotPageNo))
{

%>
<tr>
<td><td><td><B>Total CMP Value</B></td>
<td<input size="6" type="text" DISABLED VALUE="xyz"></td>

</td></td></td>
</tr>
<% }%>


Thanks a lot in Advance.

Please guide me for the needful.
Attached Images
File Type: jpg untitled.jpg (10.7 KB, 182 views)
Dec 24 '08 #1
2 2586
Dear Sir,
My doubt is sum value is comming in out.println("Sum value"+sum);
Sum value200
Sum value200
Sum value200
Sum value200
Sum value200
Sum value200
Sum value200
Sum value200


Total value should display 1600.But could you please suggest me sir why i did nt i get Total value 1600.Please rectify my code.
<%
for(int iCount=0;iCount < iNoOfRec;iCount++ )
{


int sum=Integer.parseInt((String)inVec.elementAt(3));
total=total+sum;
out.println("Sum value"+sum);
out.println("total value"+total);

}
%>
Dec 25 '08 #2
Dear Sir,
I am using Paging Concept.Everytime when i give the request i will get the data

Every page 8 records are comming then next button click next record will displayed.

Sir Now i am getting Total CMP value for the every page Which is displayed the
correct value.But i have to add all the page CMP value and dispalyed Total CMP.

Total Cmp=Pageing 1 data CMP total+Pageing 2 data CMP total+Pageing 3 data CMP total(Until the page is not completed).

Dear Sir i am begineer of j2ee programmer,Could you please suggest me how i will
approch to store old page data and dispyed total data once the page record is completed in one page(Paging concept).



int cmp_temp=Integer.parseInt((String)inVec.elementAt( 3));
cmp=cmp+cmp_temp;


out.println("CMP VALUE"+ cmp);

}

I want like Total Cmp=page1 cmp value+page2 cmp value+page3 cmp value+.....


Thanks a lot in Advance.

Regards
Sumanta
Dec 26 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Tommo | last post by:
Hello All, I am a still learning so be easy on me. I am trying to get some code to work that is using JS and Perl/CGI, I am using AS Perl and an Apache Server on XP as the webserver. Can anyone...
5
by: keith | last post by:
This may seem simple, but I'm having a bit of trouble figuring out exactly how to do it. I'm accessing a database through an ODBC link, and I have a query that returns only jobs completed that day...
1
by: owz | last post by:
This is what im trying 2 get Sales Figures for 2006 in £000's Sales staff name 1st Quarter 2nd Quarter 3rd Quarter 4th Quarter Max Min Total John Smith 24 30 15 17 30 15 86...
1
by: bruce24444 | last post by:
First of all I'm new to the forum and am working on my first database. So far I think I've done not too bad but have hit a stumbling block for which I'm not sure how to get around. What I have is...
7
by: Man-wai Chang | last post by:
function caltotal() { document.theform.txtTotal=10.00; } <form name="theform" ...> <input type=textbox maxlength=10 size=10 name="txtTotal"> <input type=textbox maxlength=10 size=10...
9
by: xxplod | last post by:
I am suppose to modify the Inventory Program so the application can handle multiple items. Use an array to store the items. The output should display the information one product at a time, including...
7
by: rohitsripathi | last post by:
i need help writing this program... i am in college and i do not have time do this right now as i need to study for another test....but this is due tonight...i will pay $5 if you accept to do it and...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a webform with several entry boxes and the user enters numbers in each box. I keep a running total (just adds all of the entries together) but am posting back to the server to do this. ...
0
by: JPDobner | last post by:
My code compiles and runs but the GUI will not display. I have tinkered with it but cannot get it to come up. Someone said I may be miscalling my GUI in this code, help? Thank you. import...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.