?
Solved

Crystal License Count Help

Posted on 2004-09-09
2
Medium Priority
?
419 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 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