Solved

Crystal License Count Help

Posted on 2004-09-09
2
415 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 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