Join - kun vise grupper som har indhold
Hejsa,Jeg har nedenstående rekursive funktion, som hiver fat i en tabel med "grupper", tjekker om den har undergrupper og om den har nogle filer i sig...
Er det muligt, kun at udskrive grupper, som enten har filer eller undergrupper i sig? Altså skippe alle tomme grupper?
response.write "<?xml version=""1.0"" encoding=""UTF-8""?>"_
&"<node>"&vbcrlf
'response.write "<node>"&vbcrlf
Dim arrRows, intParentId, intCategoryId, oRsCont
Set oRs = conn.Execute("SELECT id, IsNull(parentGroup, 0) AS parentGroupId, groupName FROM contentGroups ORDER BY groupname")
If Not (oRs.EOF AND oRs.BOF) Then
arrRows = oRs.GetRows
Call TreeView(arrRows, 0, 0)
End If
oRs.close
set oRs = nothing
Sub TreeView(byRef arrStructure, byVal intParentID, byVal intDepth)
Dim n, y
For n = 0 To UBound(arrStructure,2)
If (Arrstructure(1,n) = intParentID) Then
Response.Write "<node label="""&arrStructure(2,n) & """ isBranch=""true"">"&vbcrlf
set oRsCont = conn.execute("SELECT * FROM content WHERE groupId = "&arrStructure(0,n)&"")
if not oRsCont.bof then
response.write "<node label="""&oRsCont("name")&""" filename="""&oRsCont("filename")&""" description="""&server.htmlencode(oRsCont("description"))&""" />"&vbcrlf
end if
oRsCont.close
set oRsCont = nothing
intDepth = intDepth + 3
Call TreeView( arrStructure, arrStructure(0,n), intDepth)
intDepth = intDepth - 3
response.write "</node>"&vbcrlf
End If
Next
End Sub
response.write "<node label=""Sent"" isBranch=""true""></node>"
response.write "</node>"