Solved

Get report properties in ASP

Posted on 2004-04-21
6
918 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
Comment Utility
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
Comment Utility
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
Comment Utility
I got an error
Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 2

Expert Comment

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

Author Comment

by:apparition
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

16 Experts available now in Live!

Get 1:1 Help Now