Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection Formula problems

Status
Not open for further replies.

conjurer111

Programmer
Aug 11, 2002
76
IN
Hi,

I am calling a report file from an ASP page. However, the selection formula which I'm passing returns an empty report. However, the same report works in Visual Basic. What could be the issue. I've attached the code below.
Thanks.

Code:
<%@ Language=VBScript %>
<%
	strSelectedTeams = Request.Form(&quot;box&quot;)
	arrSelectedTeams = Split(strSelectedTeams, &quot;, &quot;, -1, 1)

		beg1 = LBound(arrSelectedTeams)
		end1 = UBound(arrSelectedTeams)
	
		tempvar=&quot;&quot;
		tempvar = &quot;{soe_mas.ddesc}='&quot; & arrSelectedTeams(beg1) & &quot;'&quot;
		
arrSelectedTeams(beg1) & &quot;'&quot;

		For I = beg1+1 To end1
			tempvar = tempvar & &quot; &quot; & &quot;or {soe_mas.ddesc}='&quot; & arrSelectedTeams(I) & &quot;'&quot;
		Next
		sval=cstr(tempvar)
%>


<%

viewer = &quot;java&quot;

response.write &quot;selection formula received is : &quot; & sval


rpttoview = &quot;d:\inetpub\[URL unfurl="true"]wwwroot\budget\reports\cssthreesoewisesum.rpt&quot;[/URL]

' Only create the Crystal Application Object on first time through
If Not IsObject ( session (&quot;oApp&quot;)) Then
Set session (&quot;oApp&quot;) = Server.CreateObject(&quot;Crystal.CRPE.Application&quot;)
End If

' Turn off all Error Message dialogs
Set oGlobalOptions = Session (&quot;oApp&quot;).Options
oGlobalOptions.MorePrintEngineErrorMessages = 0

' Open the report
If IsObject(session(&quot;oRpt&quot;)) then
	Set session(&quot;oRpt&quot;) = nothing
End if

Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(rpttoview,1)
'Session(&quot;oRpt&quot;).DiscardSavedData = True
session(&quot;oRpt&quot;).DiscardSavedData
Session(&quot;oRpt&quot;).RecordSelectionFormula = sval

' Turn off sepecific report error messages
Set oRptOptions = Session(&quot;oRpt&quot;).Options
oRptOptions.MorePrintEngineErrorMessages = 0

' Opening the page engine will cause the data to be read
Set session(&quot;oPageEngine&quot;) = session(&quot;oRpt&quot;).PageEngine

' Now decide what viewer to create
Select Case viewer

	Case &quot;java&quot;
%>
<html>
<head>
<title>Seagate Crystal Smart Viewer for Java</title>
</head>
<body bgcolor=C6C6C6>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;><!--
 	var _ns3 = false;
 	var _ns4 = false;
 	//--></SCRIPT>
 	<COMMENT><SCRIPT LANGUAGE=&quot;JavaScript1.1&quot;><!--
 	var _info = navigator.userAgent;
 	var _ns3 = (navigator.appName.indexOf(&quot;Netscape&quot;) >= 0 && _info.indexOf(&quot;Win16&quot;) < 0 && _info.indexOf(&quot;Mozilla/3&quot;) >= 0);
 	var _ns4 = (navigator.appName.indexOf(&quot;Netscape&quot;) >= 0 && _info.indexOf(&quot;Win16&quot;) < 0 && _info.indexOf(&quot;Mozilla/4&quot;) >= 0 );
 	//--></SCRIPT></COMMENT>
 		<SCRIPT LANGUAGE=&quot;JavaScript&quot;><!--
 			if(_ns3==true)
 document.writeln( '<applet code=com.seagatesoftware.img.ReportViewer.ReportViewer 		 codebase=&quot;/viewer/JavaViewer&quot; 		 id=ReportViewer width=140% height=100%  archive=&quot;/viewer/JavaViewer/ReportViewer.zip&quot;>' );
 			else if (_ns4 == true)
 document.writeln( '<applet code=com.seagatesoftware.img.ReportViewer.ReportViewer 		 codebase=&quot;/viewer/JavaViewer&quot; 		 id=ReportViewer width=140% height=100%  archive=&quot;/viewer/JavaViewer/ReportViewer.jar&quot;>' );
 			else
 document.writeln( '<applet code=com.seagatesoftware.img.ReportViewer.ReportViewer 		 codebase=&quot;/viewer/JavaViewer&quot; 		 id=ReportViewer width=140% height=100%  >' );
 		//--></SCRIPT>

 		<param name=ReportName value=&quot;rptserver.asp&quot;>
		<param name=HasGroupTree value=true>
		<param name=ShowGroupTree value=true>
		<param name=HasRefreshButton value=true>
		<param name=HasPrintButton value=true>
		<param name=HasExportButton value=true>
 		<param name=cabbase value=&quot;/viewer/JavaViewer/ReportViewer.cab&quot;>
		</applet>
</body>
</html>

<%
	Case &quot;actx&quot;
%>

<HTML>
<HEAD>
<TITLE>Seagate Crystal Smart Viewer for ActiveX</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript ONLOAD=&quot;Page_Initialize&quot;>

<OBJECT ID=&quot;CRViewer&quot;
	CLASSID=&quot;CLSID:C4847596-972C-11D0-9567-00A0C9273C2A&quot;
	WIDTH=100% HEIGHT=100%
	CODEBASE=&quot;/viewer/activeXViewer/activexviewer.cab#Version=2,2,4,36&quot;>
<PARAM NAME=&quot;EnableRefreshButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableGroupTree&quot; VALUE=1>
<PARAM NAME=&quot;DisplayGroupTree&quot; VALUE=1>
<PARAM NAME=&quot;EnablePrintButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableExportButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableDrillDown&quot; VALUE=1>
<PARAM NAME=&quot;EnableSearchControl&quot; VALUE=1>
<PARAM NAME=&quot;EnableAnimationControl&quot; VALUE=1>
<PARAM NAME=&quot;EnableZoomControl&quot; VALUE=1>
</OBJECT>

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
Sub Page_Initialize
	On Error Resume Next
	Dim webBroker
	Set webBroker = CreateObject(&quot;WebReportBroker.WebReportBroker&quot;)
	if ScriptEngineMajorVersion < 2 then
		window.alert &quot;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.&quot;
		CRViewer.ReportName = Location.Protocol + &quot;//&quot; + Location.Host +&quot;/scrreports/rptserver.asp&quot;
	else
		Dim webSource
		Set webSource = CreateObject(&quot;WebReportSource.WebReportSource&quot;)
		webSource.ReportSource = webBroker
		webSource.URL = Location.Protocol + &quot;//&quot; + Location.Host + &quot;/scrreports/rptserver.asp&quot;
		webSource.PromptOnRefresh = True
		CRViewer.ReportSource = webSource
	end if
	CRViewer.ViewReport
End Sub
-->
</SCRIPT>

</BODY>
</HTML>

<%
	Case &quot;html_frame&quot;
		response.redirect &quot;htmstart.asp&quot;

	Case &quot;html_page&quot;

	response.redirect &quot;rptserver.asp&quot;

	end select

%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top