Cicode Programming Reference > Cicode Function Categories > Report Functions Introduction > RepSetControl

RepSetControl

Sets report control information to temporarily override the normal settings for a specified report. You can change the report schedule for a periodic report, and run one-time or event-triggered reports. These new settings are set on both the primary and standby report servers, but are not saved to the database. When you restart your system, CitectSCADA uses the existing settings, defined in the Reports database.

You might need to call this function several times. For example, to change an event-triggered report to run at 6 hourly intervals, you need to change the schedule (Type 4), synchronization time (Type 3), and period (Type 2). If you use incompatible values for these options, you can get unpredictable results. To change more than one option, disable the report, set the options, and then re-enable the report.

This function is a blocking function. It will block the calling Cicode task until the operation is complete.

Syntax

RepSetControl(ReportName, Type, Data [, ClusterName] )

ReportName:

The name of the report (can be prefixed by the name of the cluster that is ClusterName.ReportName).

Type:

The type of report control information to set:

1 - The time of day at which to run the next report in Cicode (date/time) variable type. Subsequent reports are run at the times calculated from the period (Type 2) and synchronisation time (Type 3). Use Type 1 to specify a one-time report. Set the time in Data in seconds from midnight (for example, specify 6 p.m. as TimeMidNight() + (18 * 60 * 60) ).

2 - The report period. Set the new period in Data according to the report schedule (Type 4), in seconds from midnight, day of week (0 to 6, Sunday = 0), month (1 to 12), or year.

For a daily report schedule, set the report frequency in Data in seconds from midnight; for example, set Data to 6  * 60 * 60 for a 6 hourly shift report. If the report is weekly, set Data to the day of the week, for example, when Data = 2, the day is Tuesday.

3 - Synchronisation time of day of the report. Set the time in Data in seconds from midnight, for example, to synchronize at 10a.m., set Data to 10 * 60 * 60.

4 - Type of report schedule. Set Data to one of the following:

5 - Report state. Set Data to either:

Data

The new data value, dependent on the Type.

ClusterName:

Name of the cluster in which the report resides. This is optional if you have one cluster or are resolving the report server via the current cluster context. The argument is enclosed in quotation marks "".

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

RepGetControl, Report

Examples

Run the "Shift" report in 1 minute.

RepSetControl("Shift",1,TimeCurrent()+60,"ClusterXYZ");

Change weekly report to 8 hour shift starting at 7 am

RepSetControl("Weekly", 5, 1,"ClusterXYZ"); 	! disable report
RepSetControl("Weekly", 4, 1,"ClusterXYZ"); ! change mode to daily
RepSetControl("Weekly", 3, 7 * 60 * 60,"ClusterXYZ"); ! sync at 7:00:00 am
RepSetControl("Weekly", 2, 8 * 60 * 60,"ClusterXYZ"); ! run every 8 hours
RepSetControl("Weekly", 5, 0,"ClusterXYZ"); ! enable report

Change yearly report to run on March 10 at 7 am

RepSetControl("Yearly", 5, 1,"ClusterXYZ"); 	! disable report
RepSetControl("Yearly", 4, 4,"ClusterXYZ"); ! change mode to yearly
RepSetControl("Yearly", 3, 7 * 60 * 60,"ClusterXYZ"); ! sync at 7:00:00 am
RepSetControl("Yearly", 2, 31 + 28 + 10,"ClusterXYZ"); ! run on March 10th
RepSetControl("Yearly", 5, 0,"ClusterXYZ"); ! enable report

See Also

Report Functions