Solved

Get report properties in ASP

Posted on 2004-04-21
6
932 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 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