
how to get hold on this
I am using an variable and adding 1 to the value, hence will get val + 1 ..its fine....now the problem is that when i have a subgroup I dont want the slno to be shown, but should continue as soon as the subgroup is finished it should start last group number + 1,like in the example...1,2,3..,..,4,5,etc.<BR><BR><BR>sl no Desc qty<BR>1 apple 2<BR>2 pear 4<BR>3 orange 3<BR> smallOrange 2<BR> medOrange 2<BR>4 papaya 1<BR>5 strawberry 5<BR><BR><BR>How to do this...<BR><BR>thanks for your time and input<BR>cheers<BR>jay

Simple...
...when you have a subgroup don't show the number and don't add one.<BR><BR>Of course, since we have no idea HOW you KNOW that you have a subgroup, we can't begin to guess more than that.<BR><BR>Can't possibly help from the info you gave us.<BR><BR>

have a field called subgroup
well i have field called subgroup and I will make it true for the subgroup...and false for the main group..<BR><BR>I had done this sometime back...unable to get it right this time...<BR>may be I was drunk when I was doing that... :)

RE: how to get hold on this
If there is a better way to do this in SQL then go for it. But I recently had a similar problem and handled it in ASP like so. (Assuming you meant you just didn't want to SEE the sl DISPLAYED.)<BR><BR>< your opening table tag ><BR>'Your database loop<BR><tr><BR> <td>slno</td><BR> <td>Desc</td><BR> <td>Qty</td><BR></tr><BR>Do Until rs.EOF<BR> <tr><BR> <td><BR> <% <BR> If varSLNO = RS("slno) Then %><BR> <BR> <%<BR> Else<BR> varSLNO = RS("slno) <BR> Response.Write RS("slno")<BR> End If %><BR> </td><BR>... Now create the rest of the table as normal.<BR><BR>The first time you hit a slno, the 2nd "If" case will fire since you haven't even SET the variable yet. So you will response.erite the rs("slno") to the cell. <BR><BR>But next loop, since you have set the varSLNO = rs("slno"), if it's the SAME slno on this loop as last, it will just print a space into the cell.<BR><BR>You could even add more spaces to offset the following records so they are indented to show a 'subgroup' relationship.

Hmmm
Read Bill's reply. I assumed the slno was NOT unique  that it defined the groups. I may have been wrong. But, in either case, just change the variable to be set to WHATEVER defines a subgroup in your DB and it should work.

isnt this simpler than ...
have 2 variables..<BR>x = 1<BR>y = 1<BR>check for the field condition if it belongs to subgroup, do a if loop chek<BR>in the do while loop<BR><BR> if rsDispTDHC("sub_group")=false then<BR> x = x<BR> else<BR> x = empty<BR> end if<BR> Response.Write x<BR><BR>table structure goes here...<BR><BR> if x = 0 then<BR> x = y<BR> else<BR> y = y +1<BR> x = x + 1<BR> end if<BR><BR>Well the above is giving my desired results..hope I am not doing a blunder....<BR><BR>cos after 12 in the night...I go bizarre.<BR><BR>Thanks for you time and input..<BR><BR>cheers

RE: isnt this simpler than ...
I'm not quite sure I even follow what you are doing there. Maybe I'm missing something, but what could be simpler than the example I showed?<BR><BR>The subgroup data is always going to be recorded with any record to which it applies, so a a db structure would look something like:<BR><BR>sn# Item SubGroup<BR>1 Banana Fruit<BR>2 Cheery Fruit<BR>3 Orange Fruit<BR>4 Volvo Car<BR>5 Toyota Car<BR>6 Hammer Tool<BR><BR>So by comparing a blank/empty var, in this case varGroup, to the very 1st record from your rs, you KNOW the comparison will fail. Set the condition to print the SubGroup to the screen on failure of that condition. ALSO set the varGroup = to whatever subGroup you are currently on AFTER the condition fails. <BR><BR>Okay, so the 1st line in your html table would be...<BR>sn# Item SubGroup<BR>1 Banana Fruit<BR><BR>... and you have set varGroup = "Fruit"<BR><BR>Now, on the second pass through the loop you are comparing "Fruit" from varGroup to the new record. If the next record has a subGroup of Fruit also  which it does here  then you DON'T print that subGroup. But you DO keep the var set to "Fruit" and will do so until it DOESn'T MATCH the SubGroup in the rs. That will happen at:<BR><BR>sn# Item SubGroup<BR>1 Banana Fruit<BR>2 Cheery Fruit<BR>3 Orange Fruit<BR>4 Volvo Car<BR><BR>.. car. So, at the end your HTML table looks like:<BR><BR>sn# Item SubGroup<BR>1 Banana Fruit<BR>2 Cheery <BR>3 Orange <BR>4 Volvo Car<BR>5 Toyota <BR>6 Hammer Tool<BR><BR>Was that what you were after?

thanks but<eop>
well where you are making the subgroup as empty after the first one being shown...well the requirement is not that..<BR><BR>I donot want to show the slno... instead i want to print empty space but the slno should continue after all the subgroup has been printed...look at the first thread..where i have shown a small example.<BR><BR>Well bottomline..I have solved it...again I thank you for your time...and input..<BR><BR>regards<BR><BR>jay
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

