[IALabs] Scripting Module

The flag definition has to do with how to deal with the low and high setpoints. It is an integer field where each bit represents a different flag. There are 7 possible flags right now:

bit 0 - low exclusive
bit 1 - low infinite
bit 2 - high exclusive
bit 3 - high infiinite
bit 4 - any change
bit 5 - low driven (by tag)
bit 6 - high driven (by tag)

So if you want the alert to be in alarm if the value is negative infinity and <= 10, the flag would be 2. If the 10 is replaced by a tag the flag would be 66. Hope this helps.

Updated module to version 1.1.0

Added getAlarmStates and getTagAttribute to tag functions
Fixed module to allow key=value argument for gateway side scripts
Fixed NPE system.device.listDevices()


Current version: 1.1.0
Download link: IA Labs Scripting-module_1.1.0.modl
Cost: This module will be free.
Dependencies: OPC-UA module.


Two new functions added to module:

system.tag.getAlarmStates(String tagPath)states = system.tag.getAlarmStates("Path/To/Tag") for state in states: print state.name, state.severity, state.timeDeadband, state.timeDeadbandUnits, state.flags, state.loLimit, state.hiLimit, state.loTagPath, state.hiTagPath
system.tag.getAttribute(String tagPath, String attribute)print system.tag.getAttribute("Path/To/Tag", "AlertMode")The same attributes used for editTag and addTag apply.

:thumb_left:

Exactly what i expected !

Addition of a paramter to recurse browsing inside the sub folder for browseTags function will be cool.

tags = system.tag.browseTags("Folder",1) => recurse

Is there a trick for using the [color=#BF0000]w[/color][color=#BF4000]o[/color][color=#FFBF00]n[/color][color=#40FF40]d[/color][color=#008080]e[/color][color=#0080BF]r[/color][color=#0040BF]f[/color][color=#8000FF]u[/color][color=#8000BF]l [/color]addTag() function to make Client tags too?
Thanks!

Found a workaround. I can create my tags (Expression and SQL) programatically as normal tags first, then export them and change the tagType from a ‘1’ to a ‘2’, and then re-import them as Client tags. I’m sure there is a much better way; by using the proper tagType enumeration perhaps?

We finally have upgraded the scripting module to work for Ignition 7.6. You can download the new version here:

marketplace.inductiveautomation. … oduleId=46

The new version is 1.6.0 and includes the following changes:


Added ability to override UDT instances in addTag and editTag.
Added recursion, filtering, and sorting to browseTags.
The function getAlarmStates now returns an array of TagAlarmDefinition.
Works with the new alarming configurations.
Fixed the bug where alarm states get removed when editing tag.
Added ability to get data type from the browseTags function.


Documentation is included in the module. Once you install the module you will see a “View Documentation” link to the right of the module.

Support will still be handled through this forum.

[quote=“Dustin.Schroll”]Found a workaround. I can create my tags (Expression and SQL) programatically as normal tags first, then export them and change the tagType from a ‘1’ to a ‘2’, and then re-import them as Client tags. I’m sure there is a much better way; by using the proper tagType enumeration perhaps?[/quote]You can’t make client tags with this module so that is best workaround.

the recursive option “stop” on UDT type, when an UDT contain other UDT.
tags = system.tag.browseTags(parentPath=“Batterie_01”, recursive=1)

Is it possible to improve the recursive option for the browseTags function in order browse inside all UDT contained into other UDT ?
:prayer:

I will add a request in for that.

for the browse tag function, we have ASC or DESC order, can we have an option for the native order displayed in the designer tag’s tree.

Will do.

Thanks travis :thumb_left:

Any Idea for the date of the next release of the Scripting Module ?

I am working on it right now. I will have an update today.

Ok there is now a new update for the IA labs scripting module. You can download it on the marketplace:

marketplace.inductiveautomation. … oduleId=46

Here is the changelog:

  • system.tag.browseTags function now recurses UDT tags

  • New native sort order on browseTags function

  • Fixed bug that didn’t allow multiple overrides on a single tag withing a UDT

  • Added new system.opc.browse function to browse the OPC servers

  • Added system.db.runSFPrepUpdate and system.db.runSFUpdateQuery to run inserts, updates, and deletes through the store and forward system in scripting.

  • Added new OPC browse function to the expression language. Simply bind a tree view component to an expression “browse()”

  • Added new tag browse function to the expression language. Simply bind a tree view component to an expression “browseTags()”

I’ve upgrade from IA Script module 1.6.1 to 1.6.3 (b13).

num = event.source.parent.parent.Num folder = event.source.parent.getComponent('DropdownFolder').selectedStringValue tags = system.tag.browseTags(parentPath="Simulink_" + str(num) + "\\" + folder, recursive=1)

browseTags function return an error :

[quote] Traceback (most recent call last):
File “event:actionPerformed”, line 6, in
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: TagFunctionsImpl.browseTags does not have the @KeywordArgs annotation.
caused by GatewayException: TagFunctionsImpl.browseTags does not have the @KeywordArgs annotation.
caused by IllegalArgumentException: TagFunctionsImpl.browseTags does not have the @KeywordArgs annotation.

Ignition v7.6.2 (b2368)
Java: Oracle Corporation 1.7.0_21[/quote]

I’ve probably miss a new parameter but I don’t find in the module documentation ?

I would like to use the “native sort order”, could you give an example forthe synthax please ?

mazeyrat, are you still have this problem?

To sort native just put “,sort=NATIVE” as an argument.

I've tried with sort="NATIVE"
for example in my script :
system.tag.browseTags(parentPath="Param", recursive=1,sort="NATIVE")

I always have the same error :

the same error is produce with :
tags = system.tag.browseTags(parentPath="")

Any idea ?

Ok there is now a new update for the IA labs scripting module. You can download it on the marketplace:

marketplace.inductiveautomation. … oduleId=46

Here is the changelog:

  • Fixed bug with system.tag.browseTags returning error: does not have the @KeywordArgs annotation.

I’m trying to download the module, however I can’t see it on the marketplace. Where can I found it?

marketplace.inductiveautomation. … oduleId=46

Or

Go to marketplace.inductiveautomation.com, click on “Most Popular” tab and then in the IA Labs Scripting.

Next, go to “Try module” on the upper right, agree the terms, click on continue and click on “download module”