Opc ua result on a tag

I have a method in my server opc ua
I call this method from ignition with system.opcua.callMethod () ¸
my method opc itself must go read a file and return the values ​​in a tag
I ask what maximum size a tag can save full data from this files.

This is a strange way for the method to be implemented. Why doesn’t it just return the data as an output value?

Anyway, the largest value a tag could have is going to be dictated by a combination of the Max Message Size, Max String Size, and/or Max Array Size settings on the OPC UA connection to that particular server. These settings are tucked away in the Advanced category.

okay what we want is to log the data in the db after calling the method. is there any other way to do it without going directly through the tag?

If the method returned the data you could insert it into the DB in the same script you called the method from.



hello i have a script that calls an opc function ua i want to insert the result in the postgree database but after calling the script no data is recorded. thank you

callmethode = system.opcua.callMethod(
“Ignition OPC UA Server”,

paths = [

values =[

system.tag.writeBlocking(paths, values)
databaseConnection = “ignitionDb”
system.db.runPrepUpdate(“INSERT INTO brown (mydata) VALUES (?)”, [callmethode[2][0]], databaseConnection)

Have you added print statements to your script to see where it fails? What’s the result of the OPC UA method call? Print the status and return values out.

Make sure you’re running this script from the gateway scope, e.g. on a tag change script or in the message handler of a system.util.sendMessage call. It’s only available in the gateway.

You can also turn the logger for opcua.gateway.scripting.CallMethod to DEBUG to get more information about what’s happening with the method call.

hello the call of the method has succeeded his sattus is good and also I run this script from the scope of the passerelle.my method returns a bytesting but no data is saved in db

What’s the actual type of the result you get? What does it look like when you print it? What if you print type(result)?

I think a ByteString or UByte array ends up being turned into an array of java.lang.Short values, which is probably not what the DB call wants.

when I print it to a table that contains numeric values. What type of data should be defined in the database

Can you also print type(result) and tell me what that is?

I don’t know what this data is supposed to represent. If it’s opaque, your DB column should probably be a BLOB type.

If this result is not already a byte array you’ll have to convert it first in the script.

Hello I run the print can I find the result in the wrapperfile or? because I have not seen anything in the console script

In the wrapper.log files on the gateway machine.

You can also use system.util.getLogger to get a logger that can print to the gateway logs that are visible on the gateway log viewer in your browser.

that’s the result I get when I print the type of result
<type ‘array.array’>

Well that’s not super useful. Print the type of one of the array elements.

that’s the new result I get when I print the type of one of the array elements.
<type ‘int’>