[bug-16241]Ignition 8 - system.tag.importTags to create vision client tags?

Can we use this function system.tag.importTags to create vision client tags ?

collisionPolicy = "a"
filePath = "d:/test.xml"
basePath = "[client]"
system.tag.importTags(filePath, basePath, collisionPolicy)

return java.lang.NullPointerException (Ignition 8.0.10)

Is there any way to create a cision client tag by scripting in Ignition 8 ?

system.tag.configure only support gateway tags but not vision clients tag ?

The 7.9 function system.tag.loadFromFile should still work in 8.0; it’s just deprecated and thus removed from the 8.0 manual. Client tags still use the legacy tag code, so I wouldn’t expect the new functions to work with them.

system.tag.loadFromFile seems not supporting client tag ?
with provider = client, no client tags are created ???

Can you send me your client tag XML? I can breakpoint the function and see where it’s going wrong.

A simple file exported from v8.0.10

<Tags>
   <Tag name="essai" path="" type="Client">
      <Property name="Value">false</Property>
      <Property name="DataType">6</Property>
      <Property name="PollRate" mode="2">0</Property>
   </Tag>
</Tags>

Well, it’s not working because it’s not implemented. Whoops. I’ll file a ticket.

1 Like

It will be usefull to implement the exportTags function for vision client tag !
We especially need it to automate by scripting, client tags exports to xml file or json in order to commit this file in git with the project.

1 Like

@PGriffith

in 8.0.10, do you think it’s possible to use in client scope (in a module) the following 7.9 flavour class in order to export client tags of a project to xml file ?

com.inductiveautomation.ignition.common.sqltags.importexport.ClientTagExporter::
exportTags​(java.util.List nodes, java.io.Writer writer, ProgressListener progress, TagPath base)

http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.10/com/inductiveautomation/ignition/common/sqltags/importexport/ClientTagExporter.html

If yes, what are the parameter to export all the tag of [client] ?
is nodes mandatory ?

Yes, it is possible; it’s the same class that’s used internally. For nodes, just make a base TagPath of [client], then get the ClientTagProvider and call getTag; something like:

                ClientTagProvider clientProvider = context.getTagManager().getClientTagProvider("client");
                if (clientProvider instanceof SubManagerAdapter) {
                    ClientSubManager client = ((SubManagerAdapter) clientProvider).getTarget();
                    BasicTagPath path = new BasicTagPath("client");
                    List<Tag> clientTag = List.of(clientProvider.getTag(path))
                    new ClientTagExporter().exportTags(clientTags, fw, null, null);
1 Like

Is this still the best way to import client tags or will the system.tag.importTags also if the idea is to import automatically the same set of client tags to different providers how can this be done?

I'm using this script to import UDTs and I'm wondering if it would work the same for client tags.

###################To Modify###################
lineName = ''
filePath = 'fiePath'
###############################################

tags = system.tag.browse(filter={'tagType':'Provider'}).results
providersList = []
for result in tags:
	providers=str(result['fullPath'])
	x = providers.find(lineName)
	if x != -1:
		providersList.append(providers)

for result in providersList:
	print result
	system.tag.importTags(filePath, result, 'i')

Is the system.tag.loadFromFile still working on 8.1? I wanted to test on a project but got an error on the script console.

# Create variables to pass into the function
filePath = 'C:\Users\Documents\Ignition\Tags\clientAlarmcfg.xml'
provider = 'client' 
# Load the file
system.tag.loadFromFile(filePath,provider,0)

XML:

<?xml version="1.0"?>
-<Tags>

-<Tag type="Client" path="AlarmConfiguration" name="JournalName">
<Property name="Value">BP2</Property>
<Property name="DataType">7</Property>
<Property name="PollRate" mode="2">0</Property>
</Tag>

-<Tag type="Client" path="AlarmConfiguration" name="ProviderFilter">
<Property name="Value">.</Property>
<Property name="DataType">7</Property>
<Property name="PollRate" mode="2">0</Property>
</Tag>

-<Tag type="Client" path="AlarmConfiguration" name="SourceFilter">
<Property name="Value"/>
<Property name="DataType">7</Property>
<Property name="PollRate" mode="2">0</Property>
</Tag>

</Tags>