Applies To:
  • CitectSCADA 1.xx 2.xx 3.xx 4.xx 5.xx

Summary:
If you wish to run a report on the last day of the month or if you need to schedule some cicode to run at the end of the month using Events or whatever, there is currently no standard way to do it in Citect. 

Solution:
The period field in Citect Reports and Events etc is designed so that period can be set up to a yearly basis at most. There is no setting for the leap day in February. The following is a cicode function which will detect whenever it is a leap year. If you needed to run a report on the last day of the month then the control might look as follows.

Report Name : MonthEnd

Time : 23:59:00

Period : 24:00:00

Trigger : LastDayOfMonth();

 

Following is the Cicode required.

INT

FUNCTION LastDayOfMonth()

INT iTime;

iTime = TimeCurrent();

IF ( DateMonth( iTime ) <> DateMonth( iTime + 86400 ) ) THEN

RETURN ( TRUE ); // eg : if today is month 1 and tomorrow is month 2, then we are on the last day of the month!

ELSE

RETURN ( FALSE ); // eg : if tomorrow is month 1 and we are in month 1 now, then we are NOT on the last day of the month

END

END

 

Keywords:
 

Attachments