• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 956
  • Last Modified:

Get report properties in ASP

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
apparition
Asked:
apparition
  • 2
  • 2
  • 2
1 Solution
 
mlmccCommented:
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
 
Ivan_SkrinjaricCommented:
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
 
apparitionAuthor Commented:
I got an error
Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Ivan_SkrinjaricCommented:
You need crystalruntime (craxdrt.dll) registered on server to work.
0
 
apparitionAuthor Commented:
I am running RAS 9. Do I need to install Crystal reports designer to get the craxdrt.dll.
0
 
mlmccCommented:
CRAXDRT.DLL is a file that comes with Crystal Reports developer or advanced.

On the development machine I would install Crystal Reports.

mlmcc
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now