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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving Recurring Instance ID

Status
Not open for further replies.

sahumph

Programmer
Dec 16, 2004
1
US
I have a CSP page written in JavaScript that has a function to take in certain parameters and creates a report schedule (recurring instance) in Crystal Enterprise. I need to be able to retrieve the Crystal Enterprise instance ID for the recurring instance I just created. I'd like to do this in the same function so that I can store it somewhere else. I have a custom interface that contains information I would like to link to this instance ID. Does anyone know how I can create the recurring instance and retrieve the instance ID while still in the same session? Here are some of the pieces I have written:


var IStore;
IStore = RetrieveIStore();

//Retrieve the report from the InfoStore.
var reports = IStore.Query("Select * From CI_INFOOBJECTS Where SI_ID = " + reportid);

var report = reports.Item(1);
var reportInterface = report.PluginInterface("");

//I then set the format time and the smtp options before doing the following:

try
{
IStore.Schedule(reports);
}
catch (e)
{
Response.Write("<script language='javascript'> window.alert(‘Cannot email report.'); </script>");
}
 
You can approach this a couple different ways:
1) If there is no possiblity of another report being scheduled in the mean-time (not likely) you can simply requery for an instance with the parent id.
SELECT * FROM CI_INFOOBJECTS WHERE SI_PARENTID=" & rptID

2) Add a custom property to the report metadata that will uniqely identify the instance.
report.properties.add(NameofProperty, value, CEPropertyFlag)

Once you add this custom property and schedule the report, then query for the report with that property. You do not need to call the report.commit method, this new property will be added to the instance metadata.
SELECT * FROM CI_INFOOBJECTS WHERE <NameofProperty> = <value>

You can use a lot of different things as a property value. In .NET, I use Now.ToText(ddMMyyyyhhmmffffff). This creates a datatime value to six milisecond places. Not likely to be duplicated!



Chris
Data Intelligence Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top