Grandkathy
Technical User
I have an ASP page that I am trying to show a list of someones
Level 1: Direct Report
Level 2: Their Direct reports
Level 3: Their Direct Reports, etc........
I'm going to be able to go 5 different levels.
I've been able to get the page to run beautifully finally, except that the Level 3 are showing up above their respective Supervisor.
My code is as follows:
This is the sample of data I'm recieving when I run the above code: The words Level 1... are just so I can see things easier for now. Will remove them when I get this running better.
Level 1...Your Direct Reports!
Level 2... Patrick Achurra ACHT235
Level 3... Cynthia Ademujohn ADEC235
Level 2... Cynthia Ademujohn ADEC235
Level 3... Mark Aguiar AGUI235
Level 2... Mark Aguiar AGUI235
Level 3... Kelli Anthony ANTK235
Level 2... Kelli Anthony ANTK235
Level 3... Christopher Bowe BOWE235
Level 2... Christopher Bowe BOWE235
Level 3... Christine Bowlen bowq235
Level 2... Christine Bowlen bowq235
Level 3... Bob Burnett BURB255
Level 2... Bob Burnett BURB255
Level 3... John Coate COAT235
Level 2... John Coate COAT235
Level 3... Renee Hauser HAUT235
Level 2... Renee Hauser HAUT235
Level 3... Hector Smith SMIH255
Level 2... Hector Smith SMIH255
Level 3... Jon Taurman TAUJ235
Level 2... Jon Taurman TAUJ235
Level 1: Direct Report
Level 2: Their Direct reports
Level 3: Their Direct Reports, etc........
I'm going to be able to go 5 different levels.
I've been able to get the page to run beautifully finally, except that the Level 3 are showing up above their respective Supervisor.
My code is as follows:
Code:
dim rsLevel1, rsLevel2, rsLevel3, rsLevel4, rsLevel5
strShapeSQL = "SHAPE{SELECT EmpID, EmpLName, EmpFName, ParentID " &_
"FROM dbo.qEmployeesParents WHERE EmpID='"&Session("MyID")&"'} " &_
"APPEND((SHAPE{SELECT EmpID, EmpLName, EmpFName, ParentID FROM dbo.qEmployeesParents} AS Level2 "&_
"APPEND({SELECT EmpID, EmpLName, EmpFName, ParentID FROM dbo.qEmployeesParents} AS Level3 "&_
"RELATE EmpID TO ParentID))"&_
"RELATE EmpID TO ParentID)"
Set rsLevel1 = Server.CreateObject("ADODB.Recordset")
rsLevel1.Open strShapeSQL, objConn
if not rsLevel1.EOF then 'Professor
do while not rsLevel1.EOF
response.Write("Level 1...<B>Your Direct Reports!</B>")&"<br>"
response.Write("<br>")
set rslevel2 = rsLevel1("Level2").Value
if not rsLevel2.EOF then
do while not rsLevel2.EOF
response.Write"Level 2... "&(rsLevel2.Fields.Item("EmpFName").Value)&" "&(rsLevel2.Fields.Item("EmpLName").Value)&" "&(rsLevel2.Fields.Item("EmpID"))&"<br>"
rsLevel2.movenext
set rslevel3 = rsLevel2("Level3").Value
if not rsLevel3.EOF then
do while not rsLevel3.EOF
response.Write" Level 3... "&(rsLevel3.Fields.Item("EmpFName").Value)&" "&(rsLevel3.Fields.Item("EmpLName").Value)&" "&(rsLevel3.Fields.Item("EmpID"))&"<br>"
rsLevel3.movenext
Loop
end if
Loop
end if
rsLevel1.movenext
Loop
else
'give them a message they don't have any direct reports.
end if
%>
<%
objConn.Close()
Set objConn = Nothing
%>
This is the sample of data I'm recieving when I run the above code: The words Level 1... are just so I can see things easier for now. Will remove them when I get this running better.
Level 1...Your Direct Reports!
Level 2... Patrick Achurra ACHT235
Level 3... Cynthia Ademujohn ADEC235
Level 2... Cynthia Ademujohn ADEC235
Level 3... Mark Aguiar AGUI235
Level 2... Mark Aguiar AGUI235
Level 3... Kelli Anthony ANTK235
Level 2... Kelli Anthony ANTK235
Level 3... Christopher Bowe BOWE235
Level 2... Christopher Bowe BOWE235
Level 3... Christine Bowlen bowq235
Level 2... Christine Bowlen bowq235
Level 3... Bob Burnett BURB255
Level 2... Bob Burnett BURB255
Level 3... John Coate COAT235
Level 2... John Coate COAT235
Level 3... Renee Hauser HAUT235
Level 2... Renee Hauser HAUT235
Level 3... Hector Smith SMIH255
Level 2... Hector Smith SMIH255
Level 3... Jon Taurman TAUJ235
Level 2... Jon Taurman TAUJ235