on 05-20-2011 10:12 AM
I'm planning Crystal reports from my application to Crystal Reports Server in the email queue. I want to sent the reports as pdf. Sending emails works fine. In the CMS (Crystal Reports Server) I can see the history and scheduled reports with their parameters.
I would like to retrieve the parameters and used email addresses in my application for completed reports (history) and scheduled reports.
If I retrieve the history, the infoObjects that are scheduled as "Report", but when I retrieve them from the history it appears they are not object type Report but type Pdf:
string query = "Select SI_ID, SI_NAME, SI_OWNER, SI_DESCRIPTION, SI_STATUS, SI_STATUSINFO " +
",SI_RECURRING, SI_SCHEDULEINFO.SI_OUTCOME " +
"FROM CI_INFOOBJECTS " +
"WHERE SI_KIND='CrystalReport' AND SI_RECURRING=0";
dt.Columns.Add("Naam");
dt.Columns.Add("Weetniet");
dt.Columns.Add("Eigenaar");
dt.Columns.Add("Status");
dt.Columns.Add("");
dt.Columns.Add("");
InfoObjects infoObjects = infoStore.Query(query);
foreach (InfoObject infoObject in infoObjects)
{
try
{
Report report = (Report)infoObject;
dt.Rows.Add(
infoObject.Title,
infoObject.Properties["SI_NAME"],
infoObject.Properties["SI_OWNER"],
infoObject.SchedulingInfo.Status,
(CeScheduleType)infoObject.SchedulingInfo.Type,
infoObject.Properties["SI_STATUSINFO"]
);
}
catch (Exception e)
{
Alert.Show("Fout in opvragen geschiedenis\n" + e);
}
}
The instruction "Report report = (Report)infoObject;" throws the exception:
Unable to cast object of type 'CrystalDecisions.Enterprise.Desktop.Pdf' to type 'CrystalDecisions.Enterprise.Desktop.Report'.
For the Pdf Object I cannot find the properties to find the email addresses and parameters. Since I can see these in the CMS, they must be there somewhere...
Does anyone know how to do this?
you cannot cast report instance of pdf type to Report interface object. For PDF instances, just get the
SI_SCHEDULEINFO.SI_DESTINATIONS and SI_PARAMS property bag of the InfoObject of pdf type and go throught the property bag properties to retrieve destination or parameter information.
If you query for the pdf instance using query builder you can check the structure of those property bags.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Get SI_PROCESSINFO which has SI_PROMPTS propertybag. SI_PROMPTS has SI_NUM_PROMPTS property whose value equals number of prompts the report has. SI_PROMPTS also has SI_PROMPT1, SI_PROMPT2...property bags depending on number of prompts. Traverse the SI_PROMPT<i> property bag to get SI_CURRENT_VALUES -> SI_VALUE1 -> SI_DATA
SI_DATA contains the actual value used.
Look at the property bag structure in the query buiilder.
Thanks, this helped a lot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.