Solved

Get report properties in ASP

Posted on 2004-04-21
6
928 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

829 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