Reporting: Example of API Method to display Service Notes in a Scheduled Users report

The following topics about using the AyaNova developers API with reports are examples we have provided for experienced developers.

If you do not have development experience, we are happy to provide you with a quote to prepare a specific custom report that uses the API to obtain data not available through its datasets. Contact support@ayanova.com with details of what you would like - i.e. from what grid the report would be available from, what data it is that you want, example of use, etc.

In this example, we want to show the workorder item’s Service Notes in the sample Scheduled Users summary report from the Scheduled Users grid. Normally the Service Notes field is not available for reporting from the available dataset in the Scheduled Users grid; with the API we can easily show this field.

  1. Download and import the sample report template Example API Method calling Service Notes in Scheduled Users Summary Report and review its scripts for an example of use. You will also want to refer of course to the http://api.ayanova.com business object library.

  2. As always, declare the namespace in the Before Print for the whole report in xtraReport1

using GZTW.AyaNova.BLL;
using CSLA;

  1. Example of what is in the Before Print script for the detail band detailBand1

private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{

//first get the id of the WO Item using an existing datafield from the Field List
Guid gWOItemID = new Guid(GetCurrentColumnValue(“LT_WorkorderItem_Label_ID”).ToString());

//now that we have the Item we can fetch the workorder from the woitem id
Workorder w = Workorder.GetWorkorderByRelativeNoMRU(RootObjectTypes.WorkorderItem,gWOItemID);

//now get the correct workorder item from this workorder
WorkorderItem wi = w.WorkorderItems[gWOItemID];

label1.Text = wi.TechNotes.ToString();

}