Solved

Get report properties in ASP

Posted on 2004-04-21
6
921 Views
Last Modified: 2012-05-04
How do I display report properties such as "report name", "description", "created by" using ASP.
I have an application that displays a list of reports in a directory and then once a user clicks on
a report it opens a viewer with the following code:
====================================================================================
<%@ Language=VBScript CodePage=65001 ENABLESESSIONSTATE = False %>
<% Option Explicit
' Note - the CodePage=65001 is needed to display Unicode text correctly in the viewer
'        if Session is null for ProcessHttpRequest
Dim objectFactory
Set objectFactory = CreateObject("CrystalReports.ObjectFactory.2")

Response.ExpiresAbsolute = Now() - 1
      
Dim viewer
Set viewer = objectFactory.CreateObject("CrystalReports.CrystalReportInteractiveViewer")  
viewer.Name = "page"
viewer.IsOwnForm = true       
viewer.IsOwnPage = true

Dim theReportName
theReportName = Request.Form("ReportName")
if theReportName = "" then theReportName = Request.QueryString("ReportName")
viewer.URI = "interactiveViewer.asp?ReportName=" + Server.URLEncode(theReportName)

Dim clientDoc
Set clientDoc = objectFactory.CreateObject("CrystalClientDoc.ReportClientDocument")
clientDoc.Open theReportName
viewer.ReportSource = clientDoc.ReportSource

Dim BooleanSearchControl
Set BooleanSearchControl = objectFactory.CreateObject("CrystalReports.BooleanSearchControl")
BooleanSearchControl.ReportDocument = clientDoc
viewer.BooleanSearchControl = BooleanSearchControl
viewer.ProcessHttpRequest Request, Response, Null
' ReportClientDocument will be automatically closed when clientDoc is released
%>
====================================================================================

I want to be able to display the report properties in the list page so the user can read the description
of the report(instead of just the file name) before clicking on their choice.

I only have 25 points to offer for now but will award  upto 200 for prompt reply.
0
Comment
Question by:apparition
  • 2
  • 2
  • 2
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 10881916
I know this has been asked in the past and as I recall there is no way to get at the information.

I'll look but I think it cannot be done because the report objects don't expose the information

mlmcc
0
 
LVL 2

Accepted Solution

by:
Ivan_Skrinjaric earned 60 total points
ID: 10887518
This is actualy the snipet from one of my applications that sends me the list of reports found in directrory on the server with thier comment and description and sending it back to the client script using RDS (thats why i use ADODB.Recordset).

Dim oApp, oRpt, title, subject, description, author, title
Set oApp = Server.CreateObject("CrystalRuntime.Application")

Set oRpt=oApp.OpenReport(report_file_name, 1)
title=oRpt.ReportTitle
subject.value=oRpt.ReportSubject
author=oRpt.ReportAuthor
title=oRpt.ReportTitle

Set oRpt = nothing
Set oApp = nothing

My full code is this, maybe it helps you even better:

<!-- #include file='../include/adovbs.inc' -->
<%
Dim oRS
Dim oApp
Dim oRpt
Dim oFSO, oFile, oFiles, oFolder
Dim s, Path

Set oApp = Server.CreateObject("CrystalRuntime.Application.9")
Set oRS = Server.CreateObject("ADODB.Recordset")
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")

Path = Request.ServerVariables("PATH_TRANSLATED")                    
While (Right(Path, 1) <> "\" And Len(Path) <> 0)                      
      iLen = Len(Path) - 1                                                  
      Path = Left(Path, iLen)                                              
Wend  

Path=Path & "Reports\"

Set oFolder= oFSO.GetFolder(Path)
Set oFiles = oFolder.Files

oRS.CursorLocation = adUseClient
oRS.CursorType = adOpenKeyset
oRS.LockType = adLockOptimistic

oRS.Fields.Append "Filename", adVarChar, 256, adFldIsNullable
oRS.Fields.Append "Title", adVarChar, 256, adFldIsNullable
oRS.Fields.Append "Subject", adVarChar, 256, adFldIsNullable
oRS.open

For Each oFile in oFiles
      if right(oFile.name,3)="rpt" then
            Set oRpt=oApp.OpenReport(Path & oFile.name, 1)
            oRS.addnew
            oRS("Filename").value= oFile.name
            oRS("Title").value=oRpt.ReportTitle
            oRS("Subject").value=oRpt.ReportSubject
            oRS.update
      end if
Next

Set oRpt = nothing
Set oApp = nothing
Set oFile = nothing
Set oFiles = nothing
Set oFolder = nothing
Set oFSO = nothing

response.ContentType = "text/xml"
oRS.Save Response, application("persistence")
oRS.Close
Set oRS = nothing
%>

If something is not clear please ask.

Ivan.
0
 
LVL 5

Author Comment

by:apparition
ID: 10899723
I got an error
Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Expert Comment

by:Ivan_Skrinjaric
ID: 10902818
You need crystalruntime (craxdrt.dll) registered on server to work.
0
 
LVL 5

Author Comment

by:apparition
ID: 10920532
I am running RAS 9. Do I need to install Crystal reports designer to get the craxdrt.dll.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10924720
CRAXDRT.DLL is a file that comes with Crystal Reports developer or advanced.

On the development machine I would install Crystal Reports.

mlmcc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now