System.groups missing?

I'm wanting to using system.groups.loadFromFile() but system.groups seem to be missing from my installation (8.1.32).

In the script console of Ignition Designer:

>>> import system.groups
Traceback (most recent call last):
  File "<input>", line 1, in <module>
ImportError: No module named groups
>>> import system
>>> import system.util
>>> dir(system)
['__class__', '__delattr__', '__dict__', '__doc__', '__ensure_finalizer__', 
'__findattr_ex__', '__finditem__', '__format__', '__getattribute__', '__hash__', 
'__init__', '__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', 
'__setattr__', '__setitem__', '__str__', '__subclasshook__', 'alarm', 'alert', 'clear', 
'dataset', 'date', 'db', 'device', 'dict', 'dnp3', 'file', 'getDict', 'getName', 'gui', 
'math',  'name', 'nav', 'net', 'opc', 'print', 'project', 'report', 'security', 'serial', 
'setDict', 'setName', 'sfc', 'system', 'tag', 'toString', 'user', 'util', 'vision']

How do I get system.groups?

Ignition designer scope behaves like a modified vision scope, so since system.groups only exists in gateway/perspective scopes, you won't be able to call it directly from the designer.

Try putting your script into a project library function, and then call the script via a gateway message handler. Call the handler from the designer script console.


Also, though this is hopefully implied, you must have the SQL Bridge module installed for transaction groups to exist :slight_smile:

But the core issue is scoping as @ryan.white identified.

1 Like

Thanks for the clarification of the scope. I have that part of it working now.

However when I call system.groups.loadFromFile(filename, prog, mode) I'm getting:
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Invalid file format specified.

The xml file I'm using was created using a transactionGroup exported XML file as a template. My script is saving the xml to a file in the current working dir, which appears in /usr/local/bin/ignition/ and then passing that filename to loadFromFile(). If I import that file manually in the designer then the import succeeds.

Is there any way to get more information about what the specific error is?

This is because the file needs to be named [something].xml

Now it's giving warning: Columns missing from table, and 'create table' option is not enabled. Missing columns: [...].
The documentation at system.groups.loadFromFile doesn't mention any parameters related to table creation. I see from other posts that there is a check box in the UI for "create table" but I have no idea how this would be accessed from a script.
The xml I'm using is able to be successfully imported from the designer UI (right click on Transaction Groups->import->from XML)

How do I get this to work?

Is there any other guidance available about how to diagnose this issue?