Applies To:
  • CitectSCADA 6.xx, 7.xx
  • VijeoCitect 6.xx, 7.xx
  • NEXA 6.xx, 7.xx
  • Facilities 6.xx, 7.xx

Summary:
How can we use DatabaseExchange.DataManager so that upon downloading data, the value from a column is evaluated in a given fomula prior to associating it with a Variable Tag. e.g. The value from 'Column001' of the 'DatabaseExchange.DataManager' needs to be multiplied by 100 then rounded off to '0' decimal places prior to assigning it to a Variable Tag ("PLC_1_Tag_01"). 

Solution:
To achieve the above functionality, we can use the downloading event handle in cicode (The downloading event fires everytime a download is triggered). To create this cicode function (that triggers everytime the 'DatabaseExchange.DataManager' downloads data), we need to find out the Event Class as shown below.

With the above information, create a new cicode function as shown below.

FUNCTION Test_AN36_DataDownloading(OBJECT This)  
//Note the Function Name. <Event Class>_DataDownload(OBJECT This)
STRING sValue;
     sValue = _ObjectGetProperty(This, "Column001");
]
    PLC_1_Tag_01 = Round(StrToReal(sValue)*100,0);
END

The above function should fire everytime the download event is triggered. It gets the value of the Selected Row (Column001), and assigns it to the local cicode variable "sValue". Note that the return value of  _ObjectGetProperty() is a string, therefore "sValue" is then converted to Real, multiplied by 100 then finally round off to '0' decimal place prior to assigning the value to the variable tag "PLC_1_Tag_01"

 

Keywords:
 

Attachments