Solved

Crystal License Count Help

Posted on 2004-09-09
2
406 Views
Last Modified: 2008-02-01
I am running some rpt files to a pdf export via an ASP web page.. I am using the Server.CreateObject("CrystalRuntime.Application.8.5") familiar way of doing this and for some reason or another I am frequently getting and out of license alert... but I thought once the pdf file was dropped to disk the license was released.. I know I dont have 5 simultaneous users doing this.. is there a way to track where these licenses are being held.. to release them I am using this.. on every page that I am generating the report from.. this is at the bottom..

Function DestroyObjects(ByRef ObjectToDestroy)
  If isobject(ObjectToDestroy) then
    set ObjectToDestroy = nothing
    'Not supported with IIS4, so ignore an error here.
    On Error Resume Next
    Session.Contents.Remove(ObjectToDestroy)
    On Error Goto 0
    DestroyObjects = true
      'Response.Write("Killed")
  Else
    DestroyObjects = false
      'Response.Write("Not Killed")
  End if
End Function

DestroyObjects(session("oPageEngine"))
DestroyObjects(session("oRpt"))
DestroyObjects(session("oApp"))

POSTED BELOW IS THE CALLING PAGE
================================
<%@ Language=VBScript %>
<!--#include file="../../../../../include/functions.asp" -->
<%

PageTitle = "FFIT Custom MB Format 01v1"%>
<title>
<%Response.Write(PageTitle)%></title>
<%
ExportDirectory = "D:\public\htdocs\working\"
workingURL = "http://portal.firstfleetinc.com/working/"

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

baseVirtualPath = Request.ServerVariables("PATH_INFO")
While (Right(baseVirtualPath, 1) <> "/" And Len(baseVirtualPath) <> 0)
    iLen = Len(baseVirtualPath) - 1
    baseVirtualPath = Left(baseVirtualPath, iLen)
Wend

If Not IsObject(session("oApp")) Then
    Set session("oApp") = Server.CreateObject("CrystalRuntime.Application.8.5")
    If Not IsObject(session("oApp")) Then
        response.write "Error:  Could not instantiate the Crystal Reports automation server.  Please check to see that Crystal Reports or ReCrystallize has been properly installed on the web server PC.  See the ReCrystallize Pro Getting Started guide for more information."
        response.end
    End If
End If  
 

If IsObject(session("oRpt")) Then
    set session("oRpt") = nothing
End If

Set session("oRpt") = session("oApp").OpenReport(basePath & "ffmb01v1.rpt", 1)
If Err.Number <> 0 Then
  Response.Write "Error Occurred creating Report Object: " & Err.Description
  Set Session("oRpt") = Nothing
  Set Session("oApp") = Nothing
  Session.Abandon
  Response.End
End If

session("oRpt").DiscardSavedData

session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False

 
set crtable = session("oRpt").Database.Tables.Item(1)
crtable.SetLogonInfo cstr("Trinity"), cstr("PSLive"), cstr("sa"), cstr("MYPASSWORD")
if not crtable.TestConnectivity then
    response.write "Unable to connect to data source using the following information.<BR><BR>"
    response.write "Server / ODBC data source: Trinity<BR>"
    response.write "Database / Table: PSLive<BR>"
    response.write "User Name: " & "sa<BR>"
    response.write "Please verify the database user password in this ASP file.<BR><BR>"
end if
 
Set session("oSubRpt") = session("oRpt").OpenSubreport( "MB1a.rpt" )
set crtable = session("oSubRpt").Database.Tables.Item(1)
crtable.SetLogonInfo cstr("Trinity"), cstr("PSLive"), cstr("sa"), cstr("MYPASSWORD")
if not crtable.TestConnectivity then
    response.write "ReCrystallize Warning:  Unable to connect to data source using the following information.<BR><BR>"
    response.write "Server / ODBC data source: Trinity<BR>"
    response.write "Database / Table: PSLive<BR>"
    response.write "User Name: " & "sa<BR>"
    response.write "Please verify the database user password in this ASP file.<BR><BR>"
end if

set session("ParamCollection") = Session("oRpt").Parameterfields

set Param1 =  session("ParamCollection").Item(1)
set Param2 =  session("ParamCollection").Item(2)

If Request.QueryString("mb") <> 0 Then
      ParamValue1 = "REPRINT"
      ParamValue2 = Request.QueryString("mb")
      Call Param1.SetCurrentValue (CStr(ParamValue1), 12)
      Call Param2.SetCurrentValue (CDbl(ParamValue2), 7)
Else
      ParamValue1 = "NOTREPRINT"
      ParamValue2 = Request.QueryString("mb")
      Call Param1.SetCurrentValue (CStr(ParamValue1), 12)
      Call Param2.SetCurrentValue (CDbl(ParamValue2), 7)
End if

set Param3 =  session("ParamCollection").Item(3)
ParamValue3 = Request.QueryString("billto")
Call Param3.SetCurrentValue (CStr(ParamValue3), 12)


set Param4 =  session("ParamCollection").Item(4)
ParamValue4 = Request.QueryString("datetype")
Call Param4.SetCurrentValue (CDbl(ParamValue4), 7)

set Param5 =  session("ParamCollection").Item(5)
ParamValue5 = Request.QueryString("startdate")
SPosition=Instr(ParamValue5,":")
If SPosition = "0" Then
      ParamValue5 = RTrim(ParamValue5)
      ParamValue5 = ParamValue5 & " 00:00:00"
End if
Call Param5.SetCurrentValue (CDate(ParamValue5), 16)

set Param6 =  session("ParamCollection").Item(6)
ParamValue6 = Request.QueryString("enddate")
EPosition=Instr(ParamValue6,":")
If EPosition = "0" Then
      ParamValue6 = RTrim(ParamValue6)
      ParamValue6 = ParamValue6 & " 23:59:59"
End if
Call Param6.SetCurrentValue (CDate(ParamValue6), 16)

  If IsObject (session("oPageEngine")) Then                              
     set session("oPageEngine") = nothing
  End If

set session("oPageEngine") = session("oRpt").PageEngine

%>
<% viewer = "PDF" %>
<%
if viewer = "Word" then
    exporttype = "14"
    fileextension = ".doc"
end if
if viewer = "Excel" then
    exporttype = "21"
    fileextension = ".xls"
end if
if viewer = "RTF" then
    exporttype = "4"
    fileextension = ".rtf"
end if
if viewer = "CSV" then
    exporttype = "5"
    fileextension = ".csv"
end if
if viewer = "PDF" then
    exporttype = "31"
    fileextension = ".pdf"
end if
if viewer = "HTML" then
    exporttype = "24"
    fileextension = ".htm"
end if
%>
<%
set crystalExportOptions = Session("oRpt").ExportOptions
ExportFileName = CStr(Session.SessionID) & fileextension

if viewer<>"HTML" then
    crystalExportOptions.DiskFileName = ExportDirectory & ExportFileName
else
    crystalExportOptions.HTMLFileName = basepath & ExportFileName
end if

crystalExportOptions.FormatType = CInt(exporttype)
crystalExportOptions.DestinationType = 1
Session("oRpt").Export False

Function DestroyObjects(ByRef ObjectToDestroy)
  If isobject(ObjectToDestroy) then
    set ObjectToDestroy = nothing
    'Not supported with IIS4, so ignore an error here.
    On Error Resume Next
    Session.Contents.Remove(ObjectToDestroy)
    On Error Goto 0
    DestroyObjects = true
      'Response.Write("Killed")
  Else
    DestroyObjects = false
      'Response.Write("Not Killed")
  End if
End Function

DestroyObjects(session("oPageEngine"))
DestroyObjects(session("oRpt"))
DestroyObjects(session("oApp"))

response.write "<META http-equiv=" & Chr(34) & "Refresh" & Chr(34) & " content=" & Chr(34) & "0; url=" & workingURL & exportfilename & Chr(34) & ">"

'clean up files that are more than 1 day old
 
del = DeleteFiles(1, ExportDirectory)

set  objF = Nothing
set objFC = Nothing
set objFS = Nothing
%>
0
Comment
Question by:NTGuru705
2 Comments
 
LVL 1

Author Comment

by:NTGuru705
ID: 12068640
Here is my solution...
There is not much difference but I was leaving two session variables out there...

session("oSubRpt")
session("ParamCollection")

I found a link on Crystal Site that helped...
http://support.businessobjects.com/library/kbase/articles/c2009964.asp

I am going to request closure of this item.

Here is a slightly modified version that helped me....
==============================================
Function DestroyObjects(ByRef ObjectToDestroy)
  If isobject(ObjectToDestroy) then
    set ObjectToDestroy = nothing
    'Not supported with IIS4, so ignore an error here.
    On Error Resume Next
    Session.Contents.Remove(ObjectToDestroy)
    On Error Goto 0
    DestroyObjects = true
      'Response.Write("Inside")
  Else
    DestroyObjects = false
      'Response.Write("Outside")
  End if
  if isobject(ObjectToDestroy) then
        'Response.Write("ObjectDead")
  else
        'Response.Write("ObjectStillHere")
  end if
End Function

DestroyObjects(session("oPageEngine"))
DestroyObjects(session("oRpt"))
DestroyObjects(session("oApp"))
DestroyObjects(session("oSubRpt"))
DestroyObjects(session("ParamCollection"))
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12068755
Please read entire thread.  Asker solved or content important.
Closed, 250 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Moderator
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

Suggested Solutions

Title # Comments Views Activity
Classic ASP/VBScript/ADO MSSQL Insert failure with parameters 4 22
Adding Datediff to staistics page 2 49
Select distinct 25 83
Auto Submit on dropdown box 3 56
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

895 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

12 Experts available now in Live!

Get 1:1 Help Now