Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<%@ LANGUAGE="VBSCRIPT" CodePage=65001 ENABLESESSIONSTATE = True %>
<!-- #include file="common_settings.asp" -->
<% Dim ReportName, crDatabase, crTable, Table
const DebuggingEnabled = False '*** Normally False : Set to True to Print Debugging Information ***
'*** Get Report Name ***
ReportName=Request("ReportName")
If ( DebuggingEnabled = True ) then Response.Write("ReportName="&ReportName&"<br>"):Response.Flush()
%>
<!-- #include file="AlwaysRequiredSteps.asp" -->
<% '*** Disable Error Handling ***
On Error Goto 0
'*** Initialize oApp ***
If ( Not IsObject (Session("oApp")) ) Then Set session("oApp") = Server.CreateObject("CrystalRuntime.Application") End If
'*** Initialize oRpt and Open Report ***
If IsObject(session("oRpt")) then Set session("oRpt") = Nothing End if
Set Session("oRpt") = Session("oApp").OpenReport(Request.ServerVariables("APPL_PHYSICAL_PATH") & Request("ReportName"), 1)
If ( Err.Number <> 0 ) Then
Response.Write "Error Occurred creating Report Object: " & Err.Description
Set Session("oRpt") = nothing
Set Session("oApp") = nothing
Session.Abandon
Response.End
End If
Session("oRpt").MorePrintEngineErrorMessages = False
Session("oRpt").EnableParameterPrompting = False
Session("oRpt").DiscardSavedData
For Each Table In Session("oRpt").Database.Tables
If ( DebuggingEnabled = True ) then Response.Write("SetLogonInfo for Table " & Table.Name & "<br>"):Response.Flush()
Table.SetLogonInfo CStr(s_Server), CStr(s_Database), CStr(Session("request_form_login")), CStr(Session("request_form_password"))
Next
'*** Disable Error Handling ***
On Error Goto 0
'*** Add Filtering ***
If ( Request("filter") <> "" ) Then
If ( InStrRev(session("oRpt").SQLQueryString,"ORDER BY ") > 0 ) Then
Session("oRpt").SQLQueryString = Left(Session("oRpt").SQLQueryString,InStrRev(Session("oRpt").SQLQueryString,"ORDER BY ")-1) & " WHERE ( " & Request("filter") & " ) " & Mid(Session("oRpt").SQLQueryString,InStrRev(Session("oRpt").SQLQueryString,"ORDER BY "))
Else
Session("oRpt").SQLQueryString = Session("oRpt").SQLQueryString & " WHERE ( " & Request("filter") & " )"
End If
If ( DebuggingEnabled = True ) then Response.Write("SQLQueryString with <b>Filtering</b>=" & Session("oRpt").SQLQueryString & "<br><br>"):Response.Flush()
End If
'*** Add Sorting ***
If ( Request("order_by") <> "" ) Then
If ( InStrRev(Session("oRpt").SQLQueryString,"ORDER BY ") > 0 ) Then
Session("oRpt").SQLQueryString = Session("oRpt").SQLQueryString & ","
Else
Session("oRpt").SQLQueryString = Session("oRpt").SQLQueryString & " ORDER BY"
End If
Session("oRpt").SQLQueryString = Session("oRpt").SQLQueryString & " " & Request("order_by")
If ( DebuggingEnabled = True ) then Response.Write("SQLQueryString with <b>Sorting</b>=" & Session("oRpt").SQLQueryString & "<br>"):Response.Flush()
End If
Session("oRpt").ReadRecords
If ( Err.Number <> 0 ) Then
Response.Write "Error Occurred Reading Records: " & Err.Description
Set Session("oRpt") = nothing
Set Session("oApp") = nothing
Session.Abandon
Response.End
Else
If IsObject(session("oPageEngine")) Then Set session("oPageEngine") = Nothing End If
Set Session("oPageEngine") = Session("oRpt").PageEngine
End If
%>
<!-- #include file="MoreRequiredSteps.asp" -->
<% '*** DISPLAY THE REPORT ***
Server.Transfer(rpt_CR_Report_Viewer)
%>