cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in URL reporting for Crystal reports

Former Member
0 Kudos

Hi,

I am using URL reporting for Crystal reports to print report. In my ASP.NET applications, I select the parameter for the report and use the url reporting for Crystal reports to print the crystal report. It seem got no problem at first print.

Wwhen I re-select the parameters, the crystal report keeps display the result from the previous parameters.

For example, I select start date: 01/08/2008 and end date: 31/08/2008. In the first call, the data display correctly.

Then I select start date: 01/09/2008 and end date: 17/09/2008.

And call the url reporting, the result was the data for the first report ,which was the above parameter

I am using CR XI Server.

Any idea what goes wrong?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try to use the CONNECT command as already told and see how it goes.

For more information about the connect command, read those lines below extracted from our DevLibrary:

"The CONNECT command re-establishes a connection to the Page Server and must be appended to the INIT command. By re-establishing a connection to the Page Server, the CONNECT command allows the user to reset the report's parameters and logon information, and re-process the report if necessaryu2014without the need to start a new browser session.

That is, if you use viewer A to display a report, and then you specify viewer B to view the same report in the same browser session, you will not be prompted for parameter values or database logons, and a new report job will not be opened. But, if you specify ":connect" along with the request for viewer B, the connection to the Page Server will be re-established. That means, if necessary, the user will be prompted for parameter values and logon information, and the report will be run again.

Syntax

init=<viewer>:connect

Example

This example specifies that the report will re-establish its connection to the Page Server once the URL has been processed:

http://<webserver>/businessobjects/viewrpt.cwr?id=152&apstoken=A1B2&init=java:connect

"

Cheers

Alphonse

Former Member
0 Kudos

Hi,

The report is correct now after using the code you suggested.

Can you give me the url to see more details on the url reporting? I think there are many parameters can be set in the url and I want to take a look.

Thanks.

Answers (3)

Answers (3)

Former Member
0 Kudos

You can access our DevLibrary by clicking on the following: http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm

You will find the documentation about URL Reporting under:

BusinessObjects Enterprise SDK -> COM developer guide and API reference -> Viewing Reports and Documents using URLs -> URL Reporting for Crystal Reports

Cheers

Alphonse

ted_ueda
Employee
Employee
0 Kudos

First check:

Are you specifying sRefresh=Y for OpenDocument, or init=<input viewer type here>:connect for viewrpt.cwr?

Sincerely,

Ted Ueda

Former Member
0 Kudos

Hi,

The output for the url is http://Settltest/businessobjects/viewrpt.cwr?id=3969&apstoken=SETTLTEST.SEMBAPP.CORP%403985J4lib4zAL... 11:31:20 AM&init=actx

From the above, it show my dtstartdate is '2008-08-05' and dtenddate is '2008-08-05'.

Next I select the dtstartdate = '2008-08-06' and dtenddate = ''2008-08-06'. the url is

http://Settltest/businessobjects/viewrpt.cwr?id=3969&apstoken=SETTLTEST.SEMBAPP.CORP%403988JofOfyvA7... 11:38:27 AM&init=actx

But for second result, the data is still displayed the first report result, despite the url displayed correctly.

Thanks.

Former Member
0 Kudos

Is it possible to have a look at of your code?

Cheers

Former Member
0 Kudos

Hi,

This is the function of the code that call the url reporting.

Please note that I am using CR XR R2 server to host the report.

Public Function GetReportsHTML(ByVal strCrystalEnterpriseLoginName As String, _

ByVal strCrystalEnterprisePassword As String, _

ByVal strCrystalEnterpriseAuthenticationMethod As String, _

ByVal strCrystalServer As String, _

ByVal strPathToReports As String, _

ByVal strURLQuerystring As String) As String

Dim strQuery As String 'used to query Crystal APS

Dim i As Integer 'looping counter

Dim strarrSubFolder As String() 'to hold the split parts of strPathToReports

Dim strRootFolderID As String 'to hold the ID of the root folder

Dim strFolderID As String 'to hold the ID of the particular folder

Dim objToken As String

Dim objSessionMgr

Dim objSession

Dim objTokenMgr

Dim objInfoStore

Dim objRootFolderCol

Dim objFolderCol

Dim objReportsCol

Dim objReport

Try

'=====================================

'LOGGING ON TO THE CRYSTAL APS SERVER

'====================================

objSessionMgr = Server.CreateObject("CrystalEnterprise.SessionMgr")

objSession = objSessionMgr.Logon(strCrystalEnterpriseLoginName, strCrystalEnterprisePassword, strCrystalServer, strCrystalEnterpriseAuthenticationMethod)

objTokenMgr = objSession.LogonTokenMgr

objToken = objTokenMgr.CreateLogonToken("", 1, 100)

'====================================

'END OF LOGON TO CRYSTAL APS

'====================================

'Now that we have the token, it will be used to access all reports available to the login.

'instantiate the InfoStore object, which contains all folders and reports

objInfoStore = objSession.Service("", "InfoStore")

'----


'we now want to pinpoint the folder ID containing

'the reports we want. The way to do this is:

'- Parse the strPathToReports to an array of subfolder names

'- navigate down the list until the desired folder is found

'- get all reports in this folder

'----


strPathToReports = "SettleReportUser\" & strPathToReports

'parse the strPathToReports to its subfolder levels

strarrSubFolder = UCase(strPathToReports).Split("\")

'Get the folders underneath the root folder whos name

'matches the specified path

strQuery = "SELECT SI_ID FROM CI_INFOOBJECTS WHERE SI_NAME = '" & strarrSubFolder(0) & "'"

objFolderCol = objInfoStore.Query(strQuery)

If objFolderCol.Count > 0 Then

strFolderID = objFolderCol.Item(1).ID()

Else

'lblReports.Text = "No user folders found for given path " & strarrSubFolder(0)

Exit Try

End If

'if only one level provided, it is assumed to

'be a top level user folder. If not, then

'continue down the subfolders

If strarrSubFolder.Length() > 1 Then

'Loop through array until folder is reached

For i = 1 To strarrSubFolder.Length() - 1

strQuery = "SELECT SI_ID FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Folder' AND SI_NAME = '" & strarrSubFolder(i) & "'"

objFolderCol = objInfoStore.Query(strQuery)

If objFolderCol.Count > 0 Then

strFolderID = objFolderCol.Item(1).ID()

'Else

'lblReports.Text = "Invalid subfolder: " & strarrSubFolder(i)

' Exit Try

End If

Next

End If

'Retrieve the reports of the selected folderID

strQuery = "SELECT SI_ID, SI_NAME, SI_DESCRIPTION FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Report' AND SI_PARENT_FOLDER = " & strFolderID

objReportsCol = objInfoStore.Query(strQuery)

'A string is declared to hold the HMTL information

Dim strHTMLOut As String

strHTMLOut = ""

'Loop through the Report Collection to display each report in the table.

If objReportsCol.Count > 0 Then

For i = 1 To objReportsCol.Count

'Each item in the collection is placed in the Report object as we loop through.

objReport = objReportsCol.item(i)

'The link uses the viewrpt.cwr call to call up the report On Demand in a viewer.

Response.Redirect("http://" & strCrystalServer & "/viewrpt.cwr?id=" & objReportsCol.Item(i).ID() & "&apstoken=" & Server.UrlEncode(objToken) + strURLQuerystring & "&tt=" & Now() & "&init=actx")

Next

'Else

' lblReports.Text = "No reports found for given path " & strPathToReports

Exit Try

End If

'lblReports.Text = strHTMLOut

Catch ex As Exception

'lblReports.Text = "Error occured obtaining reports<BR>" & ex.Source & "<BR>" & ex.Message & "<BR>" & ex.StackTrace

Response.Write(ex.Message)

Finally

'----


'CLEANUP

'----


objSessionMgr = Nothing

objSession = Nothing

objTokenMgr = Nothing

objToken = Nothing

objInfoStore = Nothing

objFolderCol = Nothing

objRootFolderCol = Nothing

objReportsCol = Nothing

objReport = Nothing

End Try

End Function