Get the total no. of rows greater than Zero

# Thread: Get the total no. of rows greater than Zero

1. Che
Senior Member
Join Date
Dec 1969
Posts
303

## Get the total no. of rows greater than Zero

I have 30 rows to enter some values. All of them are displyaing "0" by default. User may enter values for 17 rows and these 17 rows will have values greater than "0". I want to get the value 17 (User entered some values in 17 rows) for my next page. How do i get the 17 from this page? help me here...<BR><BR>My row looks like this<BR>-----------------------------------------------------------------<BR>&#060;td&#062;&#060;Input type=test name = "LDH&#060;%=I%&#062;" size=4 value=&#039;0&#039; onChange="UpdateTotalTeac(&#060;%=I%&#062;);TotalL DH(&#060;%=rsLenTec%&#062;)"&#062;&#060;/td&#062;<BR>-----------------------------------------------------------------

2. Senior Member
Join Date
Dec 1969
Posts
1,849

## for each... in... next

&nbsp;<BR>for each item in request.form<BR>if request(item)&#060;&#062; 0 then<BR> count = count + 1<BR>end if<BR>next<BR><BR>Your javascript variable doesn&#039;t make it to the next page unless you set a hidden variable = to what is in the JavaScript variable, then you can just query the hidden variable, otherwise you will have to do a count on the subsequent page.<BR><BR>-- Whol

3. Senior Member
Join Date
Dec 1969
Posts
96,118

## I disagree with Wholsea

His solution would have you checking *ALL* the fields in the form, even the ones that are *NOT* one of these LDHnn fields.<BR><BR>Better, I think:<BR><BR>&#060;%<BR>count = 0<BR>For i = 1 To 30 <BR> If Request("LDH" & i) &#060;&#062; "" Then count = count + 1<BR>Next<BR>%&#062;<BR><BR>I have no idea what Wholsea was talking about regarding JavaScript variables. <BR><BR>**********<BR><BR>Another way to do this would be to count the non-zero fields in JS client-side code and put that count into a hidden form field. Not any particular advantage to doing that, so far as I can see, unless you need that number to be displayed in the same page as the LDHnn fields.<BR><BR>

4. Senior Member
Join Date
Dec 1969
Posts
1,849

## In the origional post...

Looked like they were trying to count the fields as they set them up, but were not saving that count anywhere. So I hinted towards the fact tahat they needed to put that count someplace, so I could be accessed from the processing page.<BR>

5. Senior Member
Join Date
Dec 1969
Posts
96,118

## Wasn't disagreeing with concept...

...only the implementation of it. Sorry if I implied otherwise.<BR><BR>Truthfully, I&#039;m still not sure if the poster wanted to do this client-side or server-side.<BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•