Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8411

Re: Download generated instance of a Report c#

$
0
0

Dennis,

 

the best way would be to find the last successful instance of the report using following query

 

SELECT SI_ID, SI_PARENTID, SI_NAME, SI_LAST_SUCCESSFUL_INSTANCE_ID

FROM CI_INFOOBJECTS WHERE SI_ID = ReportID

 

 

OR

 

 

SELECT SI_ID, SI_PARENTID, SI_NAME, SI_LAST_SUCCESSFUL_INSTANCE_ID

FROM CI_INFOOBJECTS WHERE SI_NAME = ‘Report Name’ AND SI_INSTANCE = 0 AND

SI_KIND = ‘CrystalReport’

 

export the report to any format and then stream or

 

use following code to load the latest instance and then stream

 

enterpriseSession = sessionMgr.Logon("UserName", "Password", "CMSName", "Authentication");

        enterpriseService = enterpriseSession.GetService("InfoStore");

        infoStore = new InfoStore(enterpriseService);

        infoObjects = infoStore.Query("Select SI_LAST_SUCCESSFUL_INSTANCE_ID From CI_INFOOBJECTS Where SI_NAME='" + sampleReportName + "'");

 

 

        infoObject = infoObjects[1];

        int jobID = (int)infoObject.Properties["SI_LAST_SUCCESSFUL_INSTANCE_ID"].Value;

 

        EnterpriseService tempService = enterpriseSession.GetService("", "RASReportFactory");

        reportAppFactory = (ReportAppFactory)tempService.Interface;

        reportClientDocument = reportAppFactory.OpenDocument(jobID, 0);

        CrystalReportViewer1.ReportSource = reportClientDocument;

 

 

Hope it helps.

 

~ Saurabh


Viewing all articles
Browse latest Browse all 8411

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>