ConfigureTag Function Block

Help Contents


The ConfigureTag Function Block applies new configuration to a Database Tag.

Functions and Function Blocks

The ConfigureTag Function Block is intended for use in a Program Tag that runs on the Fernhill SCADA Server. A Program Tag uses a continuous execution model, where the program code runs at a fixed interval. A program uses the function block to sample the state of the tag command as it executes.

If you want to change tag configuration from an Operator Action, use the ConfigureTag Function.


The ConfigureTag Function Block has this syntax:

        ERRORMSG=>Variable-Reference );

Note: All parameters are optional.


Parameter Type Direction Description
REQ BOOL R_EDGE Input A rising edge triggers the configuration change.
TAGNAME WSTRING Input The full name of the database tag to configure.
CONFIG STRING Input The new configuration to apply to the database tag.
BUSY BOOL Output Set to TRUE while the configuration change is in progress.
REQID UDINT Output A unique identifier associated with the configuration change.
DONE BOOL Output Set to TRUE for 1 execution after the configuration change has completed.
ERROR BOOL Output Set to TRUE if there was an error executing the configuration change.
ERRORMSG WSTRING Output If ERROR is TRUE, the reason why the configuration change failed.

CONFIG Parameter

The CONFIG input parameter is the configuration change to apply to the tag. This is a STRING value that can set 1 or more configuration properties in one operation. The syntax of the CONFIG input parameter is:

config-parameter ::= { property-and-value }

property-and-value ::= property ':=' value

property ::= <The name of the configuration property>

value ::=IEC 61131-3 Literal

NewConfiguration parameter examples:

  1. Change the URL property of a Scanner Tag:


  2. Enable historic storage on an Analog Data Point Tag:


  3. Disable historic storage on an Analog Data Point Tag:



Once the configuration change begins, additional requests from the input signal REQ are ignored until the configuration change completes.

These timing diagrams show the relationship of the REQ, BUSY, DONE, and ERROR signals processing two requests. The first request completes with an error, the second request completes normally:

        +--------+     +-+ +------+
  REQ   |        |     | | |      |
      --+        +-----+ +-+      +------

        +------+       +------+
 BUSY   |      |       |      |
      --+      +-------+      +----------

               ++             ++
 DONE          ||             ||

ERROR          |       |
      ---------+       +-----------------

The BUSY signal is TRUE while the configuration change is in progress. The DONE signal is TRUE for 1 execution after the completion of the configuration change.


  1. Configure the URL property of a URL Scanner Tag before starting a refresh of the tag:
    Program Main
            (* Timer to trigger the action every 5 minutes *)
            ScanTimer : TON;
            (* A function block to configure the URL Scanner Tag *)
            ConfigureURLScanner : ConfigureTag;
            (* A function block to trigger a refresh of the URL scanner Tag *)
            RefreshURLScanner : TagRefresh;
            (* The latest URL *)
            URL : STRING;	
            (* Temporary variables used to calculate the URL *)
            URLTimestamp : DATE_AND_TIME;
            (* URL scanner tag name *)
            URLScannerTagName : WSTRING;
        (* Process the scan timer.  Interval = 5 minutes *)
        ScanTimer( IN:= NOT ScanTimer.Q, PT:=T#5m );
        (* Optimization: Only build the URL when we need to *)	
        IF ScanTimer.Q THEN
            (* Get the current time *)
            URLTimestamp := SYS_GET_TIMESTAMP();
            (* Construct the URL based on the current time *)
            URL := CONCAT( 
                FORMAT_DATE_TIME( URLTimestamp, 'yyyyMMddHHmm'),
                '.json' );
        (* Use a tag reference to get the URL Scanner tag name.
           This ensures the tag name is correctly refactored when tags are renamed or moved *)
        URLScannerTagName := %".URL Scanner.FullName";
        (* Function block to configure the URL property of the URL Scanner Tag
           Triggered when the ScanTimer completes *)
        (* Function block to refresh the URL Scanner Tag
           Triggered when the URL Scanner tag has been configured *)
            TAGNAME:=URLScannerTagName );

Further Information

Database Function Blocks

To learn about other database function blocks.

Elementary Data Types

To learn about the different types supported by Fernhill SCADA.

Core Driver

To learn about other features of the Core Driver.

ConfigureTag Function

For a function to provide the equivalent feature in an Operator Action.


For the meaning of terms used in Fernhill SCADA.