Passing parameters from View() Expression

Hi there, I’m trying to pass dataset parameters that are load from a script into a Custom Property, then I run the Expression VIEW() from Simulation Aids to Group some data, but I’m getting the following error:

Traceback (most recent call last):
File “event:mouseReleased”, line 88, in
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:351)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:325)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:278)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.moduleInvokeSafe(GatewayInterface.java:908)
at com.inductiveautomation.ignition.client.gateway_interface.ModuleRPCFactory$DynamicRPCHandler.invoke(ModuleRPCFactory.java:53)
at com.sun.proxy.$Proxy57.executeReport(Unknown Source)
at com.inductiveautomation.reporting.scripting.ClientScriptingFunctions.executeReport(ClientScriptingFunctions.java:35)
at com.inductiveautomation.reporting.common.scripting.ReportScriptingFunctionsPyWrapper.executeReport(ReportScriptingFunctionsPyWrapper.java:62)
at jdk.internal.reflect.GeneratedMethodAccessor1139.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: ImportError: No module named automation_pros

at org.python.core.Py.JavaError(Py.java:547)
at org.python.core.Py.JavaError(Py.java:538)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:192)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:546)
at org.python.core.PyObject.__call__(PyObject.java:400)
at org.python.pycode._pyx195.f$0(<event:mouseReleased>:95)
at org.python.pycode._pyx195.call_function(<event:mouseReleased>)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1687)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:806)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:206)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:297)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:57)
at com.sun.proxy.$Proxy59.mouseReleased(Unknown Source)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.desktop/java.awt.Component.processEvent(Unknown Source)
at java.desktop/java.awt.Container.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.inductiveautomation.snap.swing.RibsEventQueue.dispatchEvent(RibsEventQueue.java:99)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: ImportError: No module named automation_pros
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:351)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:325)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:278)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.moduleInvokeSafe(GatewayInterface.java:908)
at com.inductiveautomation.ignition.client.gateway_interface.ModuleRPCFactory$DynamicRPCHandler.invoke(ModuleRPCFactory.java:53)
at com.sun.proxy.$Proxy57.executeReport(Unknown Source)
at com.inductiveautomation.reporting.scripting.ClientScriptingFunctions.executeReport(ClientScriptingFunctions.java:35)
at com.inductiveautomation.reporting.common.scripting.ReportScriptingFunctionsPyWrapper.executeReport(ReportScriptingFunctionsPyWrapper.java:62)
at jdk.internal.reflect.GeneratedMethodAccessor1139.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.python.core.PyReflectedFunction.call(PyReflectedFunction.java:190)
… 44 more
Caused by: ImportError: No module named automation_pros

at org.python.core.Py.ImportError(Py.java:329)
at org.python.core.imp.import_logic(imp.java:1290)
at org.python.core.imp.import_module_level(imp.java:1369)
at org.python.core.imp.importName(imp.java:1504)
at org.python.core.PyType$TypeResolver.readResolve(PyType.java:2674)
at jdk.internal.reflect.GeneratedMethodAccessor738.invoke(null)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(null)
at java.lang.reflect.Method.invoke(null)
at java.io.ObjectStreamClass.invokeReadResolve(null)
at java.io.ObjectInputStream.readOrdinaryObject(null)
at java.io.ObjectInputStream.readObject0(null)
at java.io.ObjectInputStream.defaultReadFields(null)
at java.io.ObjectInputStream.readSerialData(null)
at java.io.ObjectInputStream.readOrdinaryObject(null)
at java.io.ObjectInputStream.readObject0(null)
at java.io.ObjectInputStream.readObject(null)
at java.io.ObjectInputStream.readObject(null)
at java.util.concurrent.ConcurrentHashMap.readObject(null)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(null)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(null)
at java.lang.reflect.Method.invoke(null)
at java.io.ObjectStreamClass.invokeReadObject(null)
at java.io.ObjectInputStream.readSerialData(null)
at java.io.ObjectInputStream.readOrdinaryObject(null)
at java.io.ObjectInputStream.readObject0(null)
at java.io.ObjectInputStream.defaultReadFields(null)
at java.io.ObjectInputStream.readSerialData(null)
at java.io.ObjectInputStream.readOrdinaryObject(null)
at java.io.ObjectInputStream.readObject0(null)
at java.io.ObjectInputStream.readObject(null)
at java.io.ObjectInputStream.readObject(null)
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.ModuleInvoke.decodeToObject(ModuleInvoke.java:212)
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.ModuleInvoke.invoke(ModuleInvoke.java:104)
at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:431)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:86)
at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at com.inductiveautomation.catapult.handlers.RemoteHostNameLookupHandler.handle(RemoteHostNameLookupHandler.java:116)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:516)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:386)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
at java.lang.Thread.run(null)

Ignition v8.1.11 (b2021101912)
Java: Azul Systems, Inc. 11.0.11

and here is the script I’m trying to run:

Create Graphs Getting data from Custom Property with View() Expression

dt_seb = event.source.parent.DT_SCRIPT_FORM_1
dt_fc = event.source.parent.DT_SCRIPT_FORM_2

graphs = system.report.executeReport(path=“STAMPING_REP/DT_SCRIPT_REPORT_STAMPING”, project=“ANDON-KTMEX”, parameters = {“DT_SEBANGO” : dt_seb, “DT_FAULT_CODE” : dt_fc}, fileType=“xlsx”)

set file path to save the graphs

filepath_2 = ‘c:/FISReports/’ + filename_2

write the file

system.file.writeFile(filepath_2, graphs)

open the file

if filepath != None:
system.net.openURL(“file://”+filepath_2)

Please, any ideas why is not accepting this, When I force the dataset report parameters it works.
Thanks!

Something appears to be wrong with the module or your installation of it.

When I checked in the designer the values of the custom property, they look correct and the View() expression is doing what I want, is only when it runs the script has the issue.

perhaps @pturmel has some insight? Definitely seems as if there is something goofy going on with the module installation.

Do you have other places where functions from the Simulation Aids module is working correctly in the client?

Thanks for the insights, and No only on this part I started to use the VIEW() Expression to process a Dataset, that is being constructed with in a script that I run in this window.

You’re trying to use view() in a script? You can’t do that. It’s an expression only. I’ve requested a similar functionality to @pturmel but right now its an expression only. Edit: seems like you’re just using it in a custom property hmm. Also to post your script use
image or triple back ticks - its very hard to read your code and diagnose

```

code here

```

Are you using a scripting datasource in your report or an expression in your report that uses the view function? I don’t see anything in your current script referencing view or any other automation pros functionality. If you are show that.

1 Like

Hi, Sure My code is:

```# Create Graphs
graphs = system.report.executeReport(path="STAMPING_REP/DT_SCRIPT_REPORT_STAMPING", project="ANDON-KTMEX", parameters = {"DT_DATA" : dataIn_5}, fileType="xlsx")
# set file path to save the graphs
filepath_2 = 'c:/FISReports/' + filename_2
# write the file
system.file.writeFile(filepath_2, graphs)
# open the file
if filepath != None:
   system.net.openURL("file://"+filepath_2)
# Create Graphs
graphs = system.report.executeReport(path="STAMPING_REP/DT_SCRIPT_REPORT_STAMPING", project="ANDON-KTMEX", parameters = {"DT_DATA" : dataIn_5}, fileType="xlsx")
# set file path to save the graphs
filepath_2 = 'c:/FISReports/' + filename_2
# write the file
system.file.writeFile(filepath_2, graphs)
# open the file
if filepath != None:
   system.net.openURL("file://"+filepath_2)

But Found the Solution, the problem seems that runing the expression VIEW() in a custom property, then grabbing it back in a script for some reason doesn’t run the system.report.executeReport. What I endup doing is that I sent the entired raw dataset as a parameter to the report, and inside the report in a parameter I configure the View() Expression in the Raw Dataset and it worked.
Thanks everybody for your help

The view() expression function, when its logger is set to DEBUG, will place in the log the internal jython script that it produces to actually perform the operation. You can cut that and paste it into a project library script as a function with suitable parameters and call that in your other scripts.

In gateway scope, the module’s jars are entirely hidden within the module’s own classloader. Only the explicitly documented script functions are accessible from jython.

Hi @pturmel, thanks for the explanation and at the end I got it working with the view() expression done in the report designer. Just one questions, How do you setup de DEBUG mode to see the jython script?

For gateway scope, go to the Status => Logs page, click on the gear icon, search for 'automation_pros", then find logger for view(). Set it to DEBUG.

In the designer or vision client, open the diagnostics window from the Help menu, then select the log levels tab.

Thank you soo much, will try this out too.