Link to home
Start Free TrialLog in
Avatar of saunaG
saunaG

asked on

Blank report displayed in viewer when called from asp page

I am new to crystal, have the eval version of CR11 Developer Edition.

I created a report and use asp code to display the report from a web page in the activeX viewer.  I did all this using sample code from business objects.

I am trying to do the same now with a report with dynamic parameters.  
So I have a html form that passes a start and end date to an asp page that calls the report but when the report is run it just opens the viewer with no report inside.  The date range i choose definetly contains data.  I think the dates are being passed properly because first i had a type mismatch error from passing my parameters but now it is gone after i converted the text values my dates are stored as to dates.

Can anyone point me in the right direction?
I don't really know asp but have some programming experience - i am just reusing the sample code.

Thanks
Avatar of frodoman
frodoman
Flag of United States of America image

Have you tried running the report in Crystal and supplying the same parameters to make sure you get results?

Also, if you don't have it already, you should make sure your report has some static text in the Report Header section - that way even if there's a data-related problem you should at least see the static text in the viewer.  This will at least narrow down if the report is actually displaying or not.
You may also want to check out this information: http://support.businessobjects.com/library/kbase/articles/c2004405.asp  Particularly the part about an older version of the Active-X viewer already installed on the machine.
Avatar of Mike McCracken
Mike McCracken

Avatar of saunaG

ASKER

my report works in crystal and there is  a report header which is basically a title page with some text - no data

my activex viewer is working too -  i can view other reports without problems.  i can view the exact same report i am having the problem with when i remove the parameters from it.
ASKER CERTIFIED SOLUTION
Avatar of frodoman
frodoman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of saunaG

ASKER

Is this the part you want:

Session("oRpt").ParameterFields.GetItemByName("StartDate").AddCurrentValue(CDate(Request.Form("textboxFromDate")))
Session("oRpt").ParameterFields.GetItemByName("EndDate").AddCurrentValue(CDate(Request.Form("textboxEndDate")))

i think this part is ok because when i first created my html form that passes these values, i did not use the CDate function here to convert the input type text string and got a type mismatch error.  After i added the CDate function above the error disappeared and i get the blank report viewer.
Avatar of saunaG

ASKER

After that code there are 2 include files:

<%
'====================================================================================
' Retrieve the Records and Create the "Page on Demand" Engine Object
'====================================================================================

'On Error Resume Next

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
%>



<%
'This file contains the HTML code to instantiate the Smart Viewer ActiveX.      
'                                                                    
'You will notice that the Report Name parameter references the RDCrptserver10.asp file.
'This is because the report pages are actually created by RDCrptserver10.asp.
'RDCrptserver10.asp accesses session("oApp"), session("oRpt") and session("oPageEngine")
'to create the report pages that will be rendered by the ActiveX Smart Viewer.
'
%>
<HTML>
<HEAD>
<TITLE>Crystal Reports ActiveX Viewer</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 ONUNLOAD="CallDestroy();" leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0>
<OBJECT ID="CRViewer"
      CLASSID="CLSID:460324E8-CFB4-4357-85EF-CE3EBFE23A62"
      WIDTH=100% HEIGHT=99%
      CODEBASE="/crystalreportviewers11/ActiveXControls/ActiveXViewer.cab#Version=11,0,0,893" VIEWASTEXT>
<PARAM NAME="EnableRefreshButton" VALUE=1>
<PARAM NAME="EnableGroupTree" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableSearchControl" VALUE=1>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnableZoomControl" VALUE=1>
</OBJECT>

<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_Onload
      On Error Resume Next
      Dim webBroker
      Set webBroker = CreateObject("CrystalReports11.WebReportBroker.1")
      if ScriptEngineMajorVersion < 2 then
            window.alert "IE 3.02 users on NT4 need to get the latest version of VBScript or install IE 4.01 SP1. IE 3.02 users on Win95 need DCOM95 and latest version of VBScript, or install IE 4.01 SP1. These files are available at Microsoft's web site."
      else
            Dim webSource
            Set webSource = CreateObject("CrystalReports11.WebReportSource.1")
            webSource.ReportSource = webBroker
            webSource.URL = "RDCrptserver11.asp"
            webSource.PromptOnRefresh = True
            CRViewer.ReportSource = webSource
      end if
      CRViewer.ViewReport
End Sub
-->
</SCRIPT>

<script language="javascript">
function CallDestroy()
{
      window.open("Cleanup.asp");
}
</script>

</BODY>
</HTML>