Skip to Content
0
Former Member
Oct 21, 2009 at 01:50 PM

Error while Report select in .NET Appl.

21 Views

Dear Experts !!

I'm a newbie !! Apologies if its a basic problem or improper understanding on my part.

We are on BO XI 3.0 and I'm using a client installation of BO XI 3.1. I'm trying to access and schedule a crystal report using the following code. The problem is the query "Select * from ci_infoobjects " does not get this crystal report. Although, I'm able to access the same through Infoview as well as schedule through CMC. Any help will be highly appreciated.

P.S : As a last resort, I used a for loop to traverse the complete dataset and trap the report SID within. But to no result {:<}

Code attached for you reference :

String user, password, cmsName, cmsAuthType;

SessionMgr sessionMgr = new SessionMgr();

//Proivider Details for Logon to be prepared

BOEMembershipProvider boep = new BOEMembershipProvider();

int i;

//user = "asinghbo";

user = "bidevelop";

// password = "ganesha8";

password = "biril@123";

cmsName = "BOBJECT";

cmsAuthType = "secEnterprise";

try

{

EnterpriseSession sess = sessionMgr.Logon(user, password, cmsName, cmsAuthType);

EnterpriseService boEnterpriseService = sess.GetService("", "InfoStore");

//Reporting Objects

InfoStore boInfoStore;

InfoObjects boReportObjects;

InfoObject boReportObject;

Report boReport;

SchedulingInfo boSchedulingInfo;

String query;

//Create the infostore object

boEnterpriseService = sess.GetService("", "InfoStore");

boInfoStore = new InfoStore(boEnterpriseService);

//Create query to grab the desired report

query = "Select SI_ID, SI_NAME from CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise.Report'";// AND SI_ID = ''";

//+ " AND SI_NAME='AR_ER_CR_100'";

//"AND SI_ID=64454";// AND SI_INSTANCE=0";

//query = "Select SI_ID, SI_NAME from CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise.Report' "

// + "AND SI_NAME='Debtors' AND SI_INSTANCE=0";

boReportObjects = boInfoStore.Query(query);

//check for returned reports

if (boReportObjects.Count > 0)

{

for (i = 1;boReportObjects.Count<=boReportObjects.Count;i++)

{

boReportObject = boReportObjects<i>;

boReport = (Report)boReportObject;

if (boReport.ID.ToString() == "64454")

{

boSchedulingInfo = boReport.SchedulingInfo;

//Create the parameters for our recurring schedule

//run first instance 2 minutes from now

DateTime currentTime = DateTime.Now.AddMinutes(2);

//recurrance lasts for one day

DateTime endTime = currentTime.AddDays(1);

//Set the report to run on a recurring basis every 4 hours and 30 minutes

//running for one day

boSchedulingInfo.BeginDate = currentTime;

boSchedulingInfo.EndDate = endTime;

boSchedulingInfo.IntervalHours = 5;

boSchedulingInfo.IntervalMinutes = 1;

boSchedulingInfo.Type = CeScheduleType.ceScheduleTypeHourly;

//schedule the report

boInfoStore.Schedule(boReportObjects);

Response.Write("The " + boReport.Properties["SI_NAME"].ToString()

+ " report will run every 4 hours and 30 minutes for one day");

}

}

}

else

{

//no objects returned by query

Response.Write("No report objects found by query <br>");

Response.Write("Please click <a href='Default.aspx'>here</a> to return to the logon page.<br>");

}

Response.Write("You are logged in!!!!!");

}

catch (Exception exp)

{

Response.Write("ERROR: " + exp.ToString());

}

Regds,

Srinivasan.