Write a Custom TagImport API 
Write your own custom TagImport module to interface with VTScada's importer. This will allow you to import tags using the Tag Import Selector via the Tag Browser.
Variables
The following variables are part of the API in the module (typically a driver tag type) where TagImport will be run.
Ready
Required. True if the tag is fully set up and ready to accept an import request. Defaults to false.
CannotImportAWC
Optional. True if the import cannot be completed on an anywhere client. Defaults to false.
TagImport Module
The module must be named TagImport.
<
{================================= TagImport ==================================}
{ Module to pass tags to VTScada to import via the Tag Import Selector }
{==============================================================================}
TagImport
Required. This module is in charge of populating the import data and reporting its status back to VTScada's importer. This is a launched module (and therefore must be slayed at the end). TagImport can have multiple states, allowing for additional user interaction before returning the import tag data structure.
Parameters
TagData { Set of tag data structures to import };
pErr { Error message to pass back };
pTagCount { Tag count to give user progress feedback };
pShowProgress { TRUE to show the progress dialog };
TagData (Required)
Must be populated with import information. This is a dictionary keyed by tag name and containing Parameter dictionary and Tag Type (by module name) elements. Each TagDataStruct in the TagData dictionary represents a single tag to be passed into the next stage of the import process.
For example, to create the full set of import information required for a tag called “ContextName\IOTagName” with a Read address of “HR1”:
TagData[“ContextName\IOTagName”] = \TagDataStruct(); TagData[“ContextName\IOTagName”].Type = “IO”; TagData[“ContextName\IOTagName”].Parms = Dictionary(); TagData[“ContextName\IOTagName”].Parms[“ReadAddress”] = “HR1”;
There are no limits of the tag type or parameter names that can be used here; this can be used for custom types as well as VTScada tag types.
The final three parameters to TagImport are optional pointers to return status information about the update.
These must be dereferenced (*pErr = ...) to be set inside the import module.
pErr (Optional)
Error message to pass back. pErr can be set to the following values:
\#TAGIMPORT_ERR_NONE = 0; - No error
\#TAGIMPORT_ERR_NOT_READY = 1; - The system is not in a state where TagImport can run safely
\#TAGIMPORT_ERR_ABORTED = 2; - A programmatic or user-issued cancellation of the import
pTagCount (Optional)
The current number of tags we have added to TagData.
pShowProgress (Optional)
TRUE to show the progress bar dialog, FALSE to hide it.
Import Support Module
Required. This brings into scope the 'ImportTags' module, containing internal supporting constants and structures that the custom import module may need to function. Make sure to add the below module call at the start of the custom script.
\System.ImportAPI(\Code.ImportTags);
Abort Tag Import Process
Optional. Allows a user to abort fetching the tag data at any point. This module pairs with the TagImport module and is declared in the same place.
TagImport Module { Module to import PLC tags to VTS };
AbortImport Module { Module to abort the TagImport };{=============================== AbortImport =================================}
{ Aborts the ongoing import process. }
{=============================================================================}
AbortImport
AbortImport [
If 1;
[
AbortTagImport = TRUE;
Return();
]
]
{ End of AbortImport }
The abortion is triggered by the abort button displayed on the dialog during the import and AbortTagImport is consumed by TagImport to prevent the abort from continuing . If used this way, AbortTagImport must be declared in a common scope (e.g. the root tag module)