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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CE prompting still prompting for parameters 1

Status
Not open for further replies.

tsuable

Programmer
Feb 2, 2005
41
US
Hello,

I have this method that calls the report and (should) pass the parameter... but, CE still asks me for the paramters....any ideas?? I just inherited this code and i am pretty new to CE and asp...



Sub ShowReport()
Dim ReportID
Dim sReportLink

ReportID = Session("ReportID")

If ReportID > "" Then
sReportLink = "viewrpt.cwr?id=" & ReportID & "&apstoken=" & crToken & "&init=html_frame:connect"
End If

For Each oSessionParam In Session.Contents
If Left(LCase(oSessionParam), 9) = "promptex-" Then
sReportLink = sReportLink & "&" & oSessionParam & "=" & Session.Contents.Item(oSessionParam)
End If
Next
Call GarbageCollect()
Response.Redirect(sReportLink)
End If

Thank you so much
 
Hi,
To help debug what is actually happening revise your code to this:
Code:
Sub ShowReport()
Dim ReportID
Dim sReportLink

ReportID = Session("ReportID")

If ReportID > "" Then
sReportLink = "viewrpt.cwr?id=" & ReportID & "&apstoken=" & crToken & "&init=html_frame:connect" 
End If

For Each oSessionParam In Session.Contents
If Left(LCase(oSessionParam), 9) = "promptex-" Then
sReportLink = sReportLink & "&" & oSessionParam & "=" & Session.Contents.Item(oSessionParam)
End If
Next 
Call GarbageCollect()
[COLOR=red]
Response.Write(sReportLink)
[/color]
'Response.Redirect(sReportLink) 
End If

Then post the URL that is displays.. I suspect the "&" may be causing a problem...If so, URL encode it first.


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
ok thanks. this is what i got...

viewrpt.cwr?id=119087&apstoken=JKAWEB08@119679JKFRJrzdDW6lCPx3119677JZjfNLnlyg35sQtg&init=html_frame:connectNo Error APS = jkaweb08



Microsoft VBScript runtime error '0x800A01A8'

Object required: 'crInfoStore'
line: 122


**Im pretty sure crInfoStore is initialized...this is the whole code in my csp file..

<%
Option Explicit
'runs in the Crystal Reports Web Engine

'copy the ASP session variables
'into Crystal's session object
Session.Abandon
Call GetSessionFromString()

Dim sm
Dim crSession
Dim sAPS
Dim sLoginType
Dim sLoginName
Dim sPassword
Dim crInfoStore
Dim crLogonTokenMgr
Dim crToken
Dim oSessionParam

sAPS = Request.ServerVariables("WCS_NAME_SERVER")
sLoginType = "secWindowsNT"
sLoginName = "Administrator"
sPassword = "jka_admin_4925"


'Build a Crystal session object (not the .csp session)
Set sm = CreateObject("CrystalEnterprise.SessionMgr")
Set crSession = sm.Logon(sLoginName, sPassword, sAPS, sLoginType)


'build a session-level Info Store
Set crInfoStore = crSession.Service ("", "InfoStore")
Session("InfoStore") = crInfoStore


Set crLogonTokenMgr = crSession.LogonTokenMgr
crToken = crLogonTokenMgr.CreateLogonToken("", 1, 100)

Call ShowReport()
%>

<HTML>
<HEAD>

<script language="VBScript" runat="server">

Sub GetSessionFromString()
Dim aTemp
Dim aTemp2
Dim sTemp
Dim x

sTemp = Request.QueryString
aTemp = Split(sTemp, "&")

For x = 0 To UBound(aTemp)
aTemp2 = Split(aTemp(x), "=")
Session(aTemp2(0)) = Replace(aTemp2(1), "^", "&")
Next

End Sub
'______________________________________________________

Sub ShowReport()
Dim ReportID
Dim sReportLink
' Dim Test

' Test = "
ReportID = Session("ReportID")


If ReportID > "" Then
If Session("USERNAME") = "awking" Then
sReportLink = "viewrpt.cwr?id=" & ReportID & "&apstoken=" & crToken & "&init=actx:connect"
Else
sReportLink = "viewrpt.cwr?id=" & ReportID & "&apstoken=" & crToken & "&init=html_frame:connect"
'sReportLink = "viewrpt.cwr?id=" & ReportID & "&apstoken=" & crToken & "&init=actx:connect"
End If
For Each oSessionParam In Session.Contents
If Left(LCase(oSessionParam), 9) = "promptex-" Then
sReportLink = sReportLink & "&" & oSessionParam & "=" & Session.Contents.Item(oSessionParam)
End If
Next
Call GarbageCollect()

Response.Write(sReportLink)

'Response.Redirect(sReportLink)
End If

If Err.Number <> 0 then
Response.Write "Error number: " & CStr(Err.Number)
Response.write Err.Description
else
Response.write "No Error"
end if

End Sub
'______________________________________________________

Sub GarbageCollect()

Set crLogonTokenMgr = Nothing
Set crInfoStore = Nothing
Set crSession = Nothing
Set sm = Nothing
Session.Abandon ()
End Sub
'______________________________________________________

Sub ListAllReports()
Dim Result
Dim sTemp
Dim x
'SI_CHILDREN SI_FLAGS SI_ID SI_OBTYPE SI_OWNER SI_OWNERID SI_PARENT_FOLDER SI_PARENTID SI_INSTANCE SI_TARGETID SI_UPDATE_TS SI_VERSIONS SI_OBJECT_IS_CONTAINER SI_CREATION_TIME SI_HIDDEN_OBJECT SI_DESCRIPTION SI_PROGID SI_LOCAL_FILEPATH SI_NAME SI_FILES SI_HASTHUMBNAIL SI_TURNONTHUMBNAIL

Set Result = crInfoStore.Query("Select SI_ID, SI_NAME From CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise.Report'")

For Each sTemp In Result
Response.Write sTemp.Properties.Item("SI_ID").Value & " - " _
& sTemp.Properties.Item("SI_NAME").Value & "<p>"
Next

Set Result = Nothing
End Sub
'______________________________________________________

</script>

</HEAD>
<BODY>
<PARAM NAME="EnableRefreshButton" VALUE=0>
APS = <%=sAPS%><br>
<P>&nbsp;</P>
<%Call ListAllReports()%>
<%
Call GarbageCollect()%>
</BODY>
</HTML>
 
HI,
In the URL:

viewrpt.cwr?id=119087&apstoken=JKAWEB08@119679JKFRJrzdDW6lCPx3119677JZjfNLnlyg35sQtg&init=html_frame:connectNo Error APS = jkaweb08


there appears to be no & between the &init=html_frame:connect
and the parameter info..


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
ok thanks for the tek-tip...

here's what i found...

i placed a "response.write" for every "oSessionParam" in the loop..

and instead of "promptex-"...

we get a "promptex%2D%40CenterID"

so "-" is replaced by "%2D%40" somehow...

i hope you can still give me a suggestion on how to go about this...

i think here is where the problem lies..

If Left(LCase(oSessionParam), 9) = "promptex-" Then
sReportLink = sReportLink & "&" & oSessionParam & "=" & Session.Contents.Item(oSessionParam)
End If

**it does not go in the "if then" statement because "promptex-" is not equal to "promptex%2D%40"

TIA for your suggestion


 
Hi,
Those 2 codes are those for
- and (

it is not unusual for them to be converted in a URL..Not sure where the ( is coming from however...
The parameter obtained from the session object will never start with promptex- , this needs to be explicity added by your code before forming a part of the URL..



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
thanks for your help..

Do you suggest that i convert them back to "-"?

Do you have a converter method you can share with me?

its also the same with the data.....

"Session.Contents.Item(oSessionParam)"

the data displayed for "(0)" is displayed as %28 0 %29

and "01/01/05" is displayed as "01%2F01%2F05"

and "01/31/05" is displayed as "01%2F31%2F05"

thanks,
 
Hi,
It usually does not matter - the browser 'knows' when they mean...

Displaying the parametrs values can be tricky if multiples are allowed..

Just add the 'promptex-' to the parameter name and send the URL to the server - it should not prompt then..



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
yeah i do that in the events page of my report...

Response.Redirect("TestPage.asp?ReportID=" & crReportID & "&promptex-@CenterID=" & CenterID & "&promptex-@RegionID=" & RegionID & "&promptex-@CorpID=" & CorpID & "&promptex-@CenterList=" &CenterList & "&promptex-@Startdate=" & StartDate & "&promptex-@EndDate=" & EndDate )


then the testpage.asp just calls launch report which calls showreport.csp which is the code above..

do you see anything wrong with the way i add the promptex to the url?
 
Those "@" look strange for the parameters, is that really the name of the parameter? (that is what the %40 is BTW).

I would assume your parameter is CorpID not @CorpID.

Kingfisher
 
yes that is right. i took away the "@" sign in all the parameters...

im almost there...

would you need a converter for this? somehow it changes the "(" and ")" to special characters...and it is the one thats passed to CE
 
The chars are being converted properly, I think - But you should probably use Server.URLEncode(yourString) to be explicit.

CE should handle the decode of the url, I doubt that's the problem.

Kingfisher
 
i fixed 3 out of 4 parameters...

CenterID - number ex. 5
RegionID - number ex. 0
CorpID - number ex. 0

but for CenterList, which is a string... ex (5, 7, 9)

i think CE does not recognize it because it giving me this error..

The syntax of the value for prompt 'CenterList' is incorrect near '-'. Please correct the syntax and try again. [On Web Component Server: jkaweb08.WCS]


and this is what i pass in:


**notice CenterList is enclosed in parenthesis...i guess that's where the problem is..

Additional Question, is there a setting that would enable CE to decode these special characters?

Where do i use "Server.URLEncode(yourString)" in my code? Do i do this when constructing the value of the parameter?

Thanks,
 
btw, this is how i did it in the method...

Sub ShowReport()
Dim ReportID
Dim sReportLink
Dim params

ReportID = Session("ReportID")


If ReportID > "" Then
sReportLink = "viewrpt.cwr?id=" & ReportID & "&apstoken=" & crToken & "&init=html_frame:connect"
End If
For Each oSessionParam In Session.Contents

If Left(LCase(oSessionParam), 8) = "promptex" Then

params = Mid(oSessionParam,12,len(oSessionParam) - 1)

sReportLink = sReportLink & "&" & "promptex" & "-" & params & "=" & Session.Contents.Item(oSessionParam)
End If

Next

Call GarbageCollect()

'Response.Write(sReportLink)

Response.Redirect(sReportLink)
End If

If Err.Number <> 0 then
Response.Write "Error number: " & CStr(Err.Number)
Response.write Err.Description
else
Response.write "&No Error"
end if

End Sub
 
If the list is a string then it should be "5","7","9"
If it is a range then ("5"-"9")

Kingfisher
 
Also supplying a Windows NT Administrator ID and password with a server name is VERY dangerous. I'd change that password right way. And don't use an Administrator account period.

Kingfisher
 
Thank you for your tips kingfisher. appreciate that.

I would also like to ask...if there is a way wherein we can pass "(5,7,9,13,75,89)" so on and so forth as the parameter...

the only reason its passed as a string is because the stored proc expects it to be in that format...

is there a way?
 
what i mean was that the data is saved by the stored proc in a table in that format..

and so the parameter passed to CE should also be in that format.."(5,7,9,13,75,89)"

thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top