0 Replies Latest reply on Jun 28, 2008 6:45 AM by rajivbahl

    Downloading CSV report from Web

      Hi


      Have anyone done this before ??


      My objective is to download the reports from Web interface of NPM in following formats


      Excel
      CSV
      PDF


      I was able to achive the excel part by making small changes in my following file


      \InetPub\SolarWinds\NetPerfMonResport.asp


      Following is my updated Report.asp file


      -------------------------------------------------------------


      <!--#include Virtual=/NetPerfMon/scripts/NetPerfMon.asp -->


      <%
       Dim WebReport
       Dim Printable


       Response.Expires = 0
       
       SelectWeb("NetPerfMon")
       VerifyLogin "USER"
       Printable = Ucase(Left(Request("Printable"),1))
       
       Set WebReport = Server.CreateObject("OrionNPMWeb.WebReport")
       WebReport.ReportFolder = NetPerfMon.CurrentAccount.ReportFolder
       WebReport.SelectReport
       WebReport.Limitation = Session("Limitation")
       WebReport.Build
       
       Select Case Ucase(Request("DataFormat"))
        Case "XML", "CSV", "CDF", "TEXT", "TXT", "RAW", "XML"
         WebReport.OutputReport
        case "EXCEL", "EXCELL", "XLS"
         WriteExcelPage
        Case Else
         WriteHTMLPage
       End Select
       
       


      Sub WriteHTMLPage()
      %>
      <% 


       If Len(WebReport.LastError)>0 Then
       %>
        <table cellpadding=10>
        <tr>
         <td class="PageHeader"><%=WebReport.Title%></td>
        </tr>
        <tr>
         <td><br><%=WebReport.LastError%></td>
        </tr>
        </table>
       <%  
       Else
        DoReport
       End If
       
      End Sub 



      Sub WriteExcelPage() %>
       <% = WebReport.OutputReport %>
      <%
      End Sub



      Sub DoReport
      %>
      <table width="100%" cellpadding="8">
      <tr valign="top">
       <td colspan=2  nowrap class="PageHeader"><%=WebReport.Report.Title%><br><font size=2><%=WebReport.Report.SubTitle%></font></td>
      <% If Printable <> "T" AND Printable <> "Y" Then %>
        <td align=right><a href="<%=URL%>&Printable=TRUE"><img src="/NetPerfMon/images/Button.Printable.gif" border=0></a></td>
      <td align=right><a href="<%=URL%>&Printable=TRUE&dataformat=XLS"><img src="/NetPerfMon/images/Button.RawData.gif" border=0></a></td>
      <% End If %>
      </tr>
      <tr valign="top">
       <td colspan=2>
       <% 
        If Len(WebReport.LastError)>0 Then
         Response.Write(WebReport.LastError)
        Else
         WebReport.OutputReport
        End If
       %>
       </td>
      </tr>
      </table>
      <%
      End sub
      %>
      ----------------------------------------------------------------------- 


      I am unable to move on to second step of making the reports downloadable in CSV file.


      I was even thinking of having the  flexibility in web interface to choose the Time duration of the report. Rather than defining different reports of daily , weekly , monthly duration.


      If someone has made this work eariler than please share your inputs. I am really stuck on this.