Applies To:
  • CitectSCADA 7.00, 7.10
  • Vijeo Citect 7.00, 7.10

Summary:
How should the time values be formatted when setting the OnTime, OffTime and AckTime fields using the AlmSummarySetFieldValue Cicode function?

Solution:
These time fields need to be formatted as a Citect Time/Date value, which is the number of seconds since 01/01/1970. No Date fields are required because the date will be extracted from the Time/Date value. The sFieldValue argument of the AlmSummarySetFieldValue Cicode function expects a STRING, so the Citect Time/Date value needs to be converted from an INTEGER to a STRING using the IntToStr Cicode function. Below is an example of the OnTime, OffTime and AckTime fields being set to the current date and time.

 

FUNCTION My_LogToAlarmSummary(STRING scomment)
 
 INT iAlmSumBrowse, iError

 AlarmSumAppend("*UserEvent");
 
   iAlmSumBrowse = AlmSummaryOpen("" , "", "My_Cluster");
    ErrSet(1)
     iError = AlmSummaryFirst(iAlmSumBrowse)
  
     WHILE iError = 0 DO
        iError = AlmSummaryNext(iAlmSumBrowse) <> 0
  
     END

     iError = AlmSummaryPrev(iAlmSumBrowse) <> 0
  
    ErrSet(0)
  
  
    iError = AlmSummarySetFieldValue(iAlmSumBrowse,"Comment",scomment)
    iError = AlmSummarySetFieldValue(iAlmSumBrowse,"OnTime",IntToStr(TimeCurrent()))
    iError = AlmSummarySetFieldValue(iAlmSumBrowse,"OffTime",IntToStr(TimeCurrent()))
    iError = AlmSummaryCommit(iAlmSumBrowse)
 
   iError = AlmSummaryClose(iAlmSumBrowse)

END

 

 

 

 

 

 

 


Keywords:
 AlmSummarySetFieldValue(), OnTime, OffTime, AckTime, Acknowledge, Alarm Summary

Attachments