Looks like I was on the right track, but the parameter doesn’t seem to be getting passed or used correctly when it is passed. Any suggestions on how to troubleshoot?
Can I pass an entire object as a parameter? Or am I going to have to break out the individual values?
You should be able to pass an object as a parameter, but in attempting to provide you an example, I found that it’s not working as intended. As a temporary workaround, you can send individual values, but long-term, the object passing should absolutely be an available option.
1 Like
I’m trying to pass a dataset from a named query into a popup via scripting, but it seems to be causing some issues. Is there a certain way to pass these? Or am I going to have to bind the data to the table instead of passing it via a parameter?
data = system.db.runNamedQuery("Arconic", "getRecipeCycles",params)
param_dictionary['datasetCycles']=data
I was probably a little too loose while replying to your previous thread. Popup Views are failing to interpret passed objects AND Arrays.
Instead of passing the data as an array, you could pass the project and queryPath values individually, then bind the Table.props.data property to a Query which uses those params.
1 Like
Ah ok, so it was related. My logic/process to convincing myself it wasn’t was flawed.
I’ll try this route then for now.
Yah, but my recommendation for passing the queryPath won’t work because we haven’t implemented a “property picker” for the queryPath input, so… You might just need to pass those two properties (project and queryPath), create a custom property (on the View, or Table Component) named whatever (“data” would be good though), bind the value of this new property to view.params.project, then use a script transform to run a named query where you also grab the value of self.view.params.queryPath
. Something like
return system.db.runNamedQuery(project=value,path=self.view.params.queryPath)
This is a big hassle, but as soon as we get the object/array passing to popups working again it’ll be a breeze. The weird thing is Embedded Views are unaffected, so this is going to take some investigation by Dev.
1 Like
This issue was fixed in the build that was uploaded today (3/19). Please let us know if you continue to see this behavior after upgrading.
I still seem to be running into this problem with today’s release. I’m passing a dataset and some other types of parameters into a popup. When the dataset is not included, everything gets passed fine, but when it is, every other value also fails to be interpreted.
@SMcIntosh Let me have someone look into this and get back to you.
We are also experiencing problems passing objects (instances of custom classes). It gives an error: “Cannot coerce value ‘’ into type: class org.python.core.PyDictionary”.
The fix for this is pending review, at which point Values, Arrays, Objects and Datasets are all fair game.
1 Like
This issue should be fixed in the newest build. Let us know if you see any other issues!
In which build number was this released?
the build from yesterday afternoon, 3/27 (b2019032708)
I’m getting unicode instead of an object. We downloaded the new update around 4:40am PST. The version says b2019032708
. I can’t tell if that is the afternoon build or not. Is the ‘08’ a build sequence number for the day, or is in the hour indicator?
Could I see how you’re passing the value and how you’re receiving the parameter?
If you’re getting unicode, it should mean that you’re reading a value (node) instead of an object. Whether the value passed along is incorrect, or the reference to the passed parameter is incorrect I would need to see how the configuration is set up.
Please provide the Script Action code or a screenshot of the Popup Action, and a screenshot of the Popup you are attempting to open which is receiving unicode, or the view.json file for the Popup View.
Configured Custom Property on a Button:
Whole Object applied as a parameter during a Popup Action:
Expected Params structure on Popup View:
Binding for Label (the “value (id node)” one):
Popup displaying different types/values of value node and object which contains the value node:
Created a new view with a single object parameter:
Attempted to pop-up the view with a button onClick event script:
testBreak = project.Schedule.Model.ShiftInstanceBreak()
testBreak.name = "Morning"
testBreak.duration = 10
params = {"testObject": testBreak}
system.perspective.openPopup("tLEtjaMm", "Test", params)
Got an error:
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File “”, line 16, in runAction RuntimeError: maximum recursion depth exceeded (Java StackOverflowError)
Attempted to define parameter object members to correspond with the object members. Same result.
Assigned the object to a custom property on the calling view, but after doing so, the custom property type does not match the object being assigned to it.
From the log:
object selected type ShiftInstanceBreak value <Model.ShiftInstanceBreak object at 0x3b45e>
custom property type unicode value <Model.ShiftInstanceBreak object at 0x3b45e>
What is ShiftInstanceBreak returning? It’s important to think of values/arrays/objects in terms of JSON values/arrays/objects, not Java Objects. Returning python classes, and/or methods will not just magically work.
Parameters passed must be simple value types (long, String, boolean, etc), arrays (python lists, or JSON arrays), or objects (python dictionaries or JSON object) or Inductive Automation Datasets.
2 Likes
That explains it. So yes, it is a python object that I am trying to pass.