Retrieving Report List item information

Several procedure trigger and function triggers are used to retrieve information about each report that you have added to a Report List. Some of these triggers are activated as the Report List displays reports. Others are activated as actions are performed on the selected or marked report. Some of these triggers are optional, and are used only in certain cases.

The following is a list of the procedure and function triggers that you can implement. All of them are located on the syReportList form.

TRIGGER_GetReportResid

This procedure trigger is used to retrieve the dictionary ID and resource ID of a report that has been added to a Report List. It is used when security access is checked for the report. If access is denied for the current user, the report will not appear in the Report List.

The following example shows the registration for this trigger from the sample integrating application.

l_result = Trigger_RegisterProcedure(script TRIGGER_GetReportResid of form syReportList, TRIGGER_AFTER_ORIGINAL,script IG_ReportList_GetReportResid);
if l_result <> SY_NOERR then
	warning "Procedure trigger registration failed.";
end if;

The following example shows the trigger processing procedure that looks up and returns the dictionary ID and resource ID for a report. Note how the Product ID and Report ID components of the syReportData composite are examined to determine which report is being queried.

inout syReportData RptData;

if RptData:'Product ID' = IG_PROD_ID then

	{Leads report}
	if (RptData:'Report ID' = ReptID_LeadsSimple) or (RptData:'Report ID' = ReptID_LeadsWithOptions) then
		RptData:'Resid' = resourceid(report IG_Leads);
		RptData:'DictID' = IG_PROD_ID;
	end if;

	{Leads List report}
	if (RptData:'Report ID' = ReptID_LeadsList) then
		RptData:'Resid' = resourceid(report IG_Leads_List);
		RptData:'DictID' = IG_PROD_ID;
	end if;

end if;

TRIGGER_GetReportCategoryName

This function trigger is used to retrieve the report category name to display for each report added to a Report List. The following example shows the registration for this trigger from the sample integrating application.

l_result = Trigger_RegisterFunction(function TRIGGER_GetReportCategoryName of form syReportList, TRIGGER_AFTER_ORIGINAL, function IG_ReportList_GetReportCategoryName);
if l_result <> SY_NOERR then
	warning "Function trigger registration failed.";
end if;

The following example shows the trigger processing function that returns the report category name for the reports included with the sample integrating application. Note how the Product ID of the syReportData composite is examined to find which product contains the report.

function returns 'Report Category Name' sCategoryName;

in syReportData RptData;

if RptData:'Product ID' = IG_PROD_ID then
	{It's one of our reports}
	sCategoryName = "Sample";
end if;

TRIGGER_GetReportDisplayName

This function trigger is used to retrieve the name to display for each report added to a Report List. The following example shows the registration for this trigger from the sample integrating application.

l_result = Trigger_RegisterFunction(function TRIGGER_GetReportDisplayName of form syReportList, TRIGGER_AFTER_ORIGINAL, function IG_ReportList_GetReportDisplayName);
if l_result <> SY_NOERR then
	warning "Function trigger registration failed.";
end if;

The following example shows the trigger processing function that returns the report display name for the reports included with the sample integrating application. Note how the Product ID and Report ID of the syReportData composite are examined to find which report is being queried.

function returns 'Report Display Name' sReportName;

in syReportData RptData;

if RptData:'Product ID' = IG_PROD_ID then
	{It's one of our reports to print}
	if RptData:'Report ID' = ReptID_LeadsSimple then
		sReportName = "Leads (Simple)";
	end if;

	if RptData:'Report ID' = ReptID_LeadsWithOptions then
		sReportName = "Leads";
	end if;

	if RptData:'Report ID' = ReptID_ContactHistory then
		sReportName = "Contact History";
	end if;

	if RptData:'Report ID' = ReptID_LeadsQuick then
		sReportName = "Leads (Other)";
	end if;

	if RptData:'Report ID' = ReptID_LeadsList then
		sReportName = "Leads List";
	end if;
end if;

TRIGGER_GetReportDestination

This procedure trigger is used to retrieve report destination information for reports that use a report options window. The following example shows the registration for this trigger from the sample integrating application.

l_result = Trigger_RegisterProcedure(script TRIGGER_GetReportDestination of form syReportList, TRIGGER_AFTER_ORIGINAL, script IG_ReportList_GetReportDestination);
if l_result <> SY_NOERR then
	warning "Procedure trigger registration failed.";
end if;

You will use the Product ID and Report ID components of the syReportData composite to determine whether your report is being queried. If it is, you will look up the report option information, and then set the components of the ReportDestOptions composite with the option settings retrieved. Refer to the description of this composite for the list of values that can be set. The information in the ReportDestOptions composite is passed to the procedure that actually runs the report.

If the “Ask Each Time” component is set to true in the composite, the Report Destination window will be displayed automatically when the report is printed from the Report List. The other settings in the composite, such as the output destinations, will be reflected in the Report Destination window. After the user makes selections in the destination window, the settings made are reflected in the ReportDestOptions composite.

If the “Ask Each Time” component isn’t set to true in the composite, the other options in the composite are passed directly to the procedure that runs the report.

The following example is the trigger processing procedure that retrieves the report options for the Leads or Leads List reports.

inout syReportData RptData;
inout ReportDestOptions RptDest;

{The user asked for a report that uses a report option. Read the option information and fill in the ReportDestOptions composite.}

{Is it one of our reports to print?}
if RptData:'Product ID' = IG_PROD_ID then
	if (RptData:'Report ID' = ReptID_LeadsWithOptions) or (RptData:'Report ID' = ReptID_LeadsList) then

		{It's the Leads or Leads List report which uses a areport option. 
		Look up the option.}
		{Don't look up <<New>> report option}
		if (RptData:'Report Option Name' <> "") and (RptData:'Report Option Name' <> getmsg(7487)) then

			'Report ID' of table IG_Leads_ROPT = integer(RptData:'Report Option ID');
			'Report Option Name' of table IG_Leads_ROPT = RptData:'Report Option Name';
		
			get table IG_Leads_ROPT;
			if err() = OKAY then
				{Specify the settings for the destination options composite.}
				RptDest:'Ask Each Time' = 'Ask Each Time' of table IG_Leads_ROPT;
				RptDest:'Print to Screen' = 'Print to Screen' of table IG_Leads_ROPT;
				RptDest:'Print to Printer' = 'Print to Printer' of table IG_Leads_ROPT;
				RptDest:'Print to File' = 'Print to File' of table IG_Leads_ROPT;
				RptDest:'File Export Name' = 'File Export Name' of table IG_Leads_ROPT;
				RptDest:'Export Type' = 'Export Type' of table IG_Leads_ROPT;
				RptDest:'If File Existing' = 'If File Existing' of table IG_Leads_ROPT;
			else
				error "Could not retrieve report option " +  RptData:'Report Option Name' + ".";
			end if;
		end if;
	end if;
end if;

TRIGGER_GetOptionsWindowIDs

This procedure trigger indicates which report options window to open for reports that use report options. The following example shows the registration for this trigger from the sample integrating application.

l_result = Trigger_RegisterProcedure(script TRIGGER_GetOptionsWindowIDs of form syReportList, TRIGGER_AFTER_ORIGINAL, script IG_ReportList_GetOptionsWindowIDs);
if l_result <> SY_NOERR then
	warning "Procedure trigger registration failed.";
end if;

You will use the Product ID and Report ID components of the syReportData composite to determine which report is being queried. If it is your report and uses an options window, return your product ID and the resource ID of the form that defines the report options window.

The following example is the trigger processing procedure that retrieves the ID of the report options window used for the Leads and Leads List reports.

inout syReportData RptData;
inout DictID nDictID;
inout FormID nFormID;

if RptData:'Product ID' = IG_PROD_ID then
	{It's one of our reports with options to print}
	if (RptData:'Report ID' = ReptID_LeadsWithOptions) or (RptData:'Report ID' = ReptID_LeadsList) then
		{It's a report that uses an options window}
		nDictID = IG_PROD_ID;
		nFormID = resourceid(form IG_Leads_Reports);
	end if;
end if;

The Report List starts the process of opening the report options window for your report. You must provide a form-level procedure on your report option form that will be called by the Report List. This procedure must be named “OpenOptionFromList” and take one “in” parameter of type syReportData. The procedure will open the report options window. It will also use the information passed into the procedure through the syReportData composite to determine which report option should be displayed.

The following is the form-level procedure that was added to the IG_Leads_Reports form for the sample integrating application. Note that it examines the report option information passed in through the syReportData composite. If a specific report option name is named, that option is displayed in the window.

Procedure: OpenOptionFromList

 

in syReportData rptData;

{Open the Report Options window.}
open form IG_Leads_Reports;
open window 'Leads Report Options';

{Based on the data passed in, display the appropriate report option.}
'Report ID' of window 'Leads Report Options' = rptData:'Report ID';

if rptData:'Report ID' = ReptID_LeadsWithOptions then
	'(L) Report Name' of window 'Leads Report Options' = "Leads";
end if;

if rptData:'Report ID' = ReptID_LeadsList then
	'(L) Report Name' of window 'Leads Report Options' = "Leads List";
end if;

{Load the existing options}
call FillOptionsList of form IG_Leads_Reports;

if (rptData:'Report Option Name' <> "") and (rptData:'Report Option Name' <> getmsg(7487)) then
	'(L) Report Options' of window 'Leads Report Options' =  rptData:'Report Option Name';
	run script '(L) Report Options' of window 'Leads Report Options';
end if;

TRIGGER_GetSmartListObjectSeries

This procedure trigger is used only for SmartList favorites. It is used to retrieve information about a selected SmartList favorite in the Report List. The trigger processing procedure must have the following parameters:

in DictID nObjectDictID;
in 'Report ID' nObjectID;
inout 'Report Series DictID';
inout 'Report Series ID' nSeriesID;
inout 'Series Name' sSeriesName;

Use the DictID and Report ID parameters to determine whether the SmartList favorite belongs to your application. If it does, set the other parameters accordingly. If you don’t use this trigger, the SmartList items for your integration will be assigned to the System series.

TRIGGER_GetProcessIDs

This procedure trigger is used only for reports that can be sent to a process server. The trigger processing procedure must have the following parameters:

inout syReportData ReportData;
inout 'Process DictID' nProcessDictID;
inout 'Process ID' nProcessID;

Use the syReportData composite to find the identity of the report. If it’s your report and can be sent to a process server, the trigger processing script must supply the Process DictID and Process ID values.


Documentation Feedback