cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve parameters from scheduled reports as pdf

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

aasavaribhave
Advisor
Advisor
0 Kudos

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.

Former Member
0 Kudos

Hi Aasari,

I managed to get the correct email addresses from the Pdf objects, but I'm still wrestling with the SI_PARAMS. Could you please tell me how to get the results from the property bag?

aasavaribhave
Advisor
Advisor
0 Kudos

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.

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks, this helped a lot.