Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving last instance by name dynamically

Status
Not open for further replies.

Duckie66

Technical User
Nov 12, 2003
19
FI
Hi,

As subject says, I'm trying to retrieve the last distance of specific raport dynamically. The reports are scheduled and that part is currently working well. But the problem comes when there are more than one instance because my .asp retrieves only the first and oldest one.

I'm using the following simple script:

Dim iStore
Set iStore = Sess.Service (\"\", \"InfoStore\")
Dim result
Set result=iStore.Query(\"Select SI_ID, SI_NAME From CI_INFOOBJEcTS Where SI_NAME='$reportid' And SI_INSTANCE_OBJECT=1\")
Dim reportID
reportID=result(1).ID

Do you have any ideas? I know there is a parameter for my purpose but what it might be.. I didn't manage to make it work with SI_LAST_SUCCESSFUL_INSTANCE_ID either. But I hope you can help me...

Thanks for advance,

-Duckie
 
Duckie

What i am currenty doing is right after i schedule a report i get the instance id for that running report. Then i use the instance id to query the APS for that instance object

<%
Set objSession_mgr = Server.CreateObject(&quot;CrystalEnterprise.SessionMgr&quot;)
Set objEnt_session = objSession_mgr.Logon(sUsername,sAPS_pass,sAPS,sAuthentication)
Set objInfo_store = objEnt_session.Service(&quot;&quot;, &quot;InfoStore&quot;)

sqlGet_report_info = &quot;Select * from CI_INFOOBJECTS Where SI_ID = &quot; & iCE_report_id
'This gets the Report object i want to schedule
Set MyReportCol = objInfo_store.Query(sqlGet_report_info)

'... Set any parameters and DB login info

'Schedule report
objInfo_store.Schedule(MyReportCol)

'Get instance id
iInstanceID = MyReportCol.Item(1).Properties.Item(&quot;SI_NEW_JOB_ID&quot;)
%>

This code is done on a status page

<%
'This query is for getting the report status ie Scheduled, Running,Failed,Success, ofcourse you can query for different properties
sqlInstance = &quot;SELECT SI_UISTATUS FROM CI_INFOOBJECTS WHERE SI_PARENTID=&quot; & iCE_report_id &&quot; AND SI_ID = &quot; &iInstanceID

'This gets the scheduled report object
Set colInstance = objInfo_store.Query(sqlInstance)

%>

Hope this helps

Mike

PS

On a different note since you are running ASP was wondering if you have seen any thread locking issues with the logon function or loginwithtoken function. When this thread locking issue occurs it prevents any user from executing the login function from the current webserver.

Also any problems with IIS memory continue to rise when running Crystal functions like logins and report schedules.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top