<< Click to Display Table of Contents >> Navigation: Modbus Universal MasterOPC Server > MasterOPC Universal Modbus Server > The Design-Time Mode > Operations in the Object Tree > Tag Import |
The Import tags command is available in the device context menu.
Upon the command, the first dialog of the import wizard is displayed:
The dialog tools are:
File – a CSV file (click
to open the standard file selection dialog)
Delimiter – a delimiter of columns in CSV file
Template – a map template (such a template defines correspondence between tag properties and CSV-file columns):
Load a template – load a user template
Edit the current template – open the current user template in the respective editor (see The Map Template Editor ; the built-in template is unavailable for user)
Create a new template – open the map template editor
Load the default template – load the built-in map template
Comment – this textbox displays a comment specified for a user template in the editor ("default template" is displayed for the built-in template)
Template parameters – this section displays parameters of a user template
The editor tools are:
Template – this textbox displays a pathname of the current user template (if the editor is opened upon the command
):
Comment – template comment
A group of tag properties (Identifier, Region, etc.):
Column of CSV file – correspondence between a tag property and a column of CSV file. In all groups except for Identifier, this parameter is available only if Use field of CSV file=TRUE.
Use constant value – a constant value for the respective tag property (that property of each imported tag will be equal to the value specified here). In all groups except for Identifier, this parameter is available only if Use field of CSV file=FALSE.
Edit conversion script – a value cell of that parameter contains the button
to open the script editor . The editor contains the preset function ConvertContent that may be used to modify a value read out from a CSV file (the Content argument) before that value is written to a tag property:
In all groups except for Identifier, this parameter is available only if Use script for conversion=TRUE.
Save – save the edited template (the file is overwritten)
Save as – save the edited template to arbitrary *.uit file (the default folder for templates is ..\TEMPLATES\)
Cancel – close the editor (all unsaved changes are discarded)
OK – close the editor (after saving)
If such an import is used, column captions in a file must be the same as in an exported file (see Tag Export ):
Name;Region;Address;DataType;Access;ByteOrder;Comment
SubDevice1{s}Group1{g}Tag1;HOLDING_REGISTERS;6;int16;ReadOnly;10325476;Device value
Group1{g}Group11{g}Tag1;HOLDING_REGISTERS;4;int16;ReadOnly;10325476;
Group1{g}Tag1;HOLDING_REGISTERS;3;int16;ReadOnly;10325476;
Tag1;HOLDING_REGISTERS;1;int16;ReadWrite;10325476;
To import, do the follows:
In the first dialog of the import wizard, click the
Load the default template button (in the Template section)
Select a *.csv file, using the tool
of the File section
Click Next; the second dialog of the import wizard is displayed (the File CSV section displays a tag table read out from the file):
Note 1. If a file contains errors, their description is displayed:
If this dialog is closed, an error is displayed red in the import dialog:
Note 2. If a file does not contain captions required, the respective message is displayed:
Select tags to be imported (the tools of this dialog are identical to tools of the dialog that is displayed upon the Export tags command – see Tag Export )
Next, there are two variants.
Variant 1
If an imported structure must be created in the device itself (but not in a subdevice or a group), click the OK button. Upon this command, selected tags along with their hierarchy are imported into the device (subdevices and groups specified in relative tag names are created):
Variant 2
If an imported structure must be created in a subdevice or in a group of the device, click the Next button. Upon this command, the third (final) dialog of the import wizard is displayed:
Then, do the follows:
Select tags to be imported (multiple-tag selection is supported in the Tags section). To select all of tags, click the button
or use the Select all command of the section context menu.
Select a device/subdevice/group. Using tools of the Device section, you can modify a device structure:
– add a subdevice to the highlighted device
– add a group to the highlighted object
– rename the highlighted object
– delete the highlighted object
– undo the last action
– redo the action undone last
Move selected tags to the required subdevice/group. To move to the highlighted subdevice/group, click
. To move to arbitrary subdevice/group, drag tags to that subdevice/group:
While moving, hierarchy of tree objects is traced. If hierarchy violation is detected, tags are not moved, and the respective message is displayed:
Click OK
Assume that tags must be imported from some file (custom.csv) whose captions do not match the built-in template:
1;2;3;4;5;6;7
MAX;HOLDING_REGISTERS;10;int16;ReadWrite;10325476;set point
Time;SERVER_ONLY;0;int16;ReadOnly;10325476;current time
Assume that comment must be modified as well.
In this case, the following template must be created:
A comment conversion code example is shown below:
In the first dialog of the import wizard, select the CSV file and the template:
Next actions are the same as described in Example of Default Import .