Is there a better way to pass parameters "viewParams" into view?

Trying to pass parameters to a perspective view when it loads using Python Scripting.

.key is set to a “value” type, this (below) works correctly but it seems odd to have to build a string like this? Is there an easier or cleaner way to assemble these parameters?

...body.viewParams.key = "{\"param1\":111,\"param2\":\"222\",\"param3\":\"333333333\"}"

I'm looking for something like (below) however, this approach changes the type of .key from "value" to "object" and the UI goes a bit whacky
	params = {"param1":111,

...body.viewParams.key = params

I feel like there’s some missing context here which would be really helpful to me in determining exactly what it is you’re trying to do. Assuming your View that you are opening expects params with keys of param1, param2, and param3, why are you trying to pass them as a “value”?

So perhaps some screenshots of the Property Editor where you are using these properties, as well as some additional insight into your code could clear things up for me? In what way are you sending these params to the other View? I know you said scripting, but are you setting values for a component, or are you doing navigation?

Regardless, you need to specify the same shape of information as the other view has defined for its parameters.


Yeah sorry about that. I'm new to Ignition, trying to learn how to work with and use it. I've inherited an Ignition project, a new job and the main person that knows about this project quit this job for another. I'm struggling to understand how all of this works. Anyway, I should just delete this question as it isn't clear at all. I can't delete it and can't figure out how to ask the question in a way that makes sense (I don't understand it yet ha) Anyway please disregard this one for now.

Your patience is appreciated thank you.

No, this sounds like a valid question, but like I said - I need a bit more information. If you could supply the view.json files for the two views in question, I could take a look at them and try to figure out exactly what you’re encountering.

1 Like

I have resolved the issue I was having.

My confusion was . . .

Trying to pass params from a view, to another view with an accordion that has 5 items that each reference another view where each instance of these views has a Report Viewer component, and a Report and ultimately the params needed to land on the separate Reports if this makes sense.

Regardless, your comment below was the solution . . .

Thanks again!

1 Like