home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 32 / IOPROG_32.ISO / SOFT / SqlEval7 / MSOLAP / samples / Samples.exe / AspAdoCubeDoc / ASPADOCubeDoc.asp
Encoding:
Text File  |  1998-10-30  |  6.6 KB  |  150 lines

  1. <%@ Language=VBScript %>
  2. <%
  3. Response.Buffer=True
  4. 'Response.Expires=0
  5. %>
  6. <html>
  7. <head>
  8. <meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
  9. </head>
  10. <body>
  11.  
  12. <%
  13. Server.ScriptTimeout=360
  14. Dim cat,cdf,di,hi,le,mem,strServer,strSource,strCubeName
  15.  
  16. '************************************************************************************
  17. '*** Set Session Variables
  18. '************************************************************************************
  19. Session("CubeName") = Request.Form("strCubeName")
  20. Session("CatalogName") = Request.Form("strCatalogName")
  21. Session("ServerName") = Request.Form("strServerName")
  22. Session("chkDim") = Request.Form("chkDimension")
  23. Session("chkHier") =  Request.Form("chkHierarchy")
  24. Session("chkLev") =  Request.Form("chkLevel")
  25.  
  26. '************************************************************************************
  27. '*** Create Catalog Object
  28. '************************************************************************************
  29. Set cat = Server.CreateObject("ADOMD.Catalog")
  30.  
  31. If Len(Session("ServerName")) > 0 Then
  32.     cat.ActiveConnection = "Data Source=" & Session("ServerName") & ";Initial Catalog=" & Session("CatalogName") & ";Provider=msolap;"
  33. Else
  34. '************************************************************************************
  35. '*** Must set OLAPServerName to OLAP Server that is
  36. '*** present on network
  37. '************************************************************************************
  38. OLAPServerName = "Please set to present OLAP Server"
  39.     cat.ActiveConnection = "Data Source=" & OLAPServerName & ";Initial Catalog=FoodMart;Provider=msolap;"
  40.     Session("ServerName") = OLAPServerName
  41.     Session("InitialCatalog") = "FoodMart"
  42. End if
  43.  
  44. If Len(Session("CubeName")) > 0 Then
  45.     Set cdf = cat.CubeDefs(Session("CubeName"))
  46. Else
  47.     Set cdf = cat.CubeDefs("Sales")
  48.     Session("CubeName")="Sales"
  49. End if
  50.  
  51. '************************************************************************************
  52. '*** Collect Information in HTML Form
  53. '************************************************************************************
  54. %>
  55. <form action="ASPADOCubeDoc.asp" method="post" id="form1" name="form1">
  56. <table>
  57.     <tr>
  58.         <td>
  59.         <b>Olap Server name:  </b><br><input type="text" id="strServerName" name="strServerName" value="<%=Session("ServerName")%>" size="20"><br>
  60.         
  61.         <b>Catalog Name:  </b><br><input type="text" id="strCatalogName" name="strCatalogName" value="<%=Session("CatalogName")%>" size="20"><br>
  62.     
  63.         <b>Cube Name:  </b><br><input type="text" id="strCubeName" name="strCubeName" value="<%=Session("CubeName")%>" size="20">
  64.         </td>
  65.         <td <TD>
  66.             <b>Add Property Detail:  </b><br>
  67.             Dimension Detail: <input type="checkbox" id="chkDimension" name="chkDimension"><br>
  68.  
  69.             Hierarchy Detail: <input type="checkbox" id="chkHierarchy" name="chkHierarchy"><br>
  70.  
  71.             Level Detail: <input type="checkbox" id="chkLevel" name="chkLevel">
  72.         </td> 
  73.     </tr>
  74. </table>
  75. <input type="submit" value="Cube Information" id="submit1" name="submit1"><input type="reset" value="Reset" id="reset1" name="reset1">
  76. </form>
  77. <%
  78.  
  79. '************************************************************************************
  80. '*** Start of Report
  81. '************************************************************************************
  82. Response.Write "<H3>Report for " & Session("CubeName") & " Cube</H3>"
  83. Response.Write "<OL TYPE='i'>"
  84.  
  85. '************************************************************************************
  86. '*** Show properties of Cube
  87. '************************************************************************************
  88.                 For i = 0 To cdf.Properties.Count - 1
  89.                     Response.Write "<LI>"
  90.                     Response.Write "<FONT size=-2>" & cdf.Properties(i).Name & ": " & cdf.Properties(i).Value & "</FONT>"
  91.                 Next
  92.                 Response.Write "</OL>"
  93.         Response.Write "<UL TYPE='SQUARE'>"   
  94.  '************************************************************************************
  95. '*** Loop to display Dimension Name and Properties if Check box is 
  96. '*** Checked
  97. '************************************************************************************
  98.         For di = 0 To cdf.Dimensions.Count - 1
  99.             Response.Write "<LI>"
  100.             Response.Write "<FONT size=4><B>Dimension: " & cdf.Dimensions(di).Name & "</B></FONT>"
  101.             If Request.Form("chkDimension") = "on" Then
  102.                 Response.Write "<OL TYPE='1'>"
  103.                 For i = 0 To cdf.Dimensions(di).Properties.Count - 1
  104.                     Response.Write "<LI>"
  105.                     Response.Write "<FONT size=-2>" & cdf.Dimensions(di).Properties(i).Name & ": " & cdf.Dimensions(di).Properties(i).Value & "</FONT>"
  106.                 Next
  107.                 Response.Write "</OL>"
  108.             End If
  109.             Response.Write "<UL TYPE= 'Circle'>"
  110. '************************************************************************************
  111. '*** Loop to display Hierarchy Name and Properties if Check box is 
  112. '*** Checked
  113. '************************************************************************************
  114.             For hi = 0 To cdf.Dimensions(di).Hierarchies.Count - 1
  115.                 Response.Write "<LI>"
  116.                 Response.Write "<FONT size=3><B>Hierarchy: " & cdf.Dimensions(di).Hierarchies(hi).Name & "</B></FONT>"
  117.                  If Request.Form("chkHierarchy") = "on" Then
  118.                     Response.Write "<OL TYPE='1'>"
  119.                     For i = 0 To cdf.Dimensions(di).Hierarchies(hi).Properties.Count - 1
  120.                         Response.Write "<LI>"
  121.                         Response.Write "<FONT size=-2>" & cdf.Dimensions(di).Hierarchies(hi).Properties(i).Name & ": " & cdf.Dimensions(di).Hierarchies(hi).Properties(i).Value & "</FONT>"
  122.                     Next
  123.                     Response.Write "</OL>"
  124.                 End If
  125.                 Response.Write "<UL TYPE='Disc'>"
  126. '************************************************************************************
  127. '*** Loop to display Level Name and Properties if Check box is 
  128. '*** Checked
  129. '************************************************************************************
  130.                 For le = 0 To cdf.Dimensions(di).Hierarchies(hi).Levels.Count - 1
  131.                     Response.Write "<LI>"
  132.                     Response.Write "<FONT size=2><B>Level: " & cdf.Dimensions(di).Hierarchies(hi).Levels(le).Name & " with a Member Count of: " & cdf.Dimensions(di).Hierarchies(hi).Levels(le).Properties("LEVEL_CARDINALITY") & "</B></FONT>"
  133.                     If Request.Form("chkLevel") = "on" Then
  134.                         Response.Write "<OL TYPE='1'>"
  135.                         For i = 0 To cdf.Dimensions(di).Hierarchies(hi).Levels(le).Properties.Count - 1
  136.                             Response.Write "<LI>"
  137.                             Response.Write "<FONT size=-2>" & cdf.Dimensions(di).Hierarchies(hi).Levels(le).Properties(i).Name & ": " & cdf.Dimensions(di).Hierarchies(hi).Levels(le).Properties(i).Value & "</FONT>"
  138.                         Next
  139.                         Response.Write "</OL>"
  140.                     End If
  141.                 Next
  142.                 Response.Write "</UL>"
  143.             Next
  144.             Response.Write "</UL>"
  145.         Next
  146.         Response.Write "</UL>"
  147. %>
  148. </body>
  149. </html>
  150.