Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

Crystal License Count Help

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
NTGuru705
Asked:
NTGuru705
1 Solution
 
NTGuru705Author Commented:
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
 
ee_ai_constructCommented:
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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