Re: Need help reviewing code please ASAP is possible
am 05.01.2007 16:57:54 von 9ntw9
it looks like you are overwriting the category everytime, so you aren't
asking if it already exists, you are asking if it already exists and
was the last one we looked at.
try doing an order by category in your query and it should work act as
a good work around ...
MrHelpMe wrote:
> Hello experts and thanks so much for having a look at this. I have the
> following peice of code that I am stumped on.
>
> [code]
>
>
>
> "8CB811"><%= Trim(objRS("Category")) %> |
>
> <%
> cat = Trim(objRS("Category"))
> while not objRS.EOF
> if cat <> Trim(objRS("Category")) then
> %>
>
>
> "8CB811"> <%= Trim(objRS("Category")) %> |
>
> <%end if
> cat = Trim(objRS("Category"))
> %>
>
> <%= Trim(objRS("ReportName")) %> |
>
> <%objRS.MoveNext()
> wend
> %>
> <% end if %>
>
>
> [/code]
>
> What this code should do is loop through the recodset and display a
> category and then underneath that category display the report name. If
> it finds a category with the same name in the recordset it should not
> display another category with the same name but instead place the
> report under the correct category. What is happening however is I am
> getting duplicate category names as follows. This is incorrect. All
> hardware reports should go under hardware. Thanks again.
>
> i.e Hardware
> Number of computers report
> Number of Hard drive report
> Software
> Number of Microsoft office licenses report
> Hardware
> Number of IPODS report
Re: Need help reviewing code please ASAP is possible
am 05.01.2007 20:32:43 von Mark Schupp
You need to sort by category so that all reports in a category are grouped
together in the recordset.
--
--Mark Schupp
"MrHelpMe" wrote in message
news:1167941566.652375.307970@i15g2000cwa.googlegroups.com.. .
> Hello experts and thanks so much for having a look at this. I have the
> following peice of code that I am stumped on.
>
> [code]
>
>
>
> "8CB811"><%= Trim(objRS("Category")) %> |
>
> <%
> cat = Trim(objRS("Category"))
> while not objRS.EOF
> if cat <> Trim(objRS("Category")) then
> %>
>
>
> "8CB811"> <%= Trim(objRS("Category")) %> |
>
> <%end if
> cat = Trim(objRS("Category"))
> %>
>
> <%= Trim(objRS("ReportName")) %> |
>
> <%objRS.MoveNext()
> wend
> %>
> <% end if %>
>
>
> [/code]
>
> What this code should do is loop through the recodset and display a
> category and then underneath that category display the report name. If
> it finds a category with the same name in the recordset it should not
> display another category with the same name but instead place the
> report under the correct category. What is happening however is I am
> getting duplicate category names as follows. This is incorrect. All
> hardware reports should go under hardware. Thanks again.
>
> i.e Hardware
> Number of computers report
> Number of Hard drive report
> Software
> Number of Microsoft office licenses report
> Hardware
> Number of IPODS report
>
Re: Need help reviewing code please ASAP is possible
am 10.01.2007 14:14:42 von clinttoris
I just wanted to say thank you to both of you for replying. I did an
order by in my stored procedure and all is well now. Thanks so much
for all your help.
9ntw9 wrote:
> it looks like you are overwriting the category everytime, so you aren't
> asking if it already exists, you are asking if it already exists and
> was the last one we looked at.
>
> try doing an order by category in your query and it should work act as
> a good work around ...
>
>
> MrHelpMe wrote:
> > Hello experts and thanks so much for having a look at this. I have the
> > following peice of code that I am stumped on.
> >
> > [code]
> >
> >
> >
> > "8CB811"><%= Trim(objRS("Category")) %> |
> >
> > <%
> > cat = Trim(objRS("Category"))
> > while not objRS.EOF
> > if cat <> Trim(objRS("Category")) then
> > %>
> >
> >
> > "8CB811"> <%= Trim(objRS("Category")) %> |
> >
> > <%end if
> > cat = Trim(objRS("Category"))
> > %>
> >
> > <%= Trim(objRS("ReportName")) %> |
> >
> > <%objRS.MoveNext()
> > wend
> > %>
> > <% end if %>
> >
> >
> > [/code]
> >
> > What this code should do is loop through the recodset and display a
> > category and then underneath that category display the report name. If
> > it finds a category with the same name in the recordset it should not
> > display another category with the same name but instead place the
> > report under the correct category. What is happening however is I am
> > getting duplicate category names as follows. This is incorrect. All
> > hardware reports should go under hardware. Thanks again.
> >
> > i.e Hardware
> > Number of computers report
> > Number of Hard drive report
> > Software
> > Number of Microsoft office licenses report
> > Hardware
> > Number of IPODS report