Component display state not changing based on param

I am trying to populate a list of inputs and outputs for a set of devices that are mostly identical. However one set of experiments has additional input parameters. I chose to use the “display” property to adjust the size of the list rather than have a blank on the other pages.

When passing the ID of the rack, I am able to load the data properly but am unable to get the display property to react to the ID. For instance, when navigating to:

When the rackID is 3, I want to display the additional information. I made a property binding on the display property that changes based on the rackId param.

if ({view.params.rackID} = 3, true, false)

This works perfectly fine in the designer preview (manually changing the URL parameter in the view properties), but fails to display in browser.

However, when I add a button on to the page with the same binding (to hide or show the element) it works just fine.

Is there a better approach to this?

I tried some other approaches as well. Changing from a property binding to an event script by binding this display change to the root.onStartUp and on the container.onStartUp thinking that the reason might be to do with when the ID is loaded. But had similar results.

What version is this?

This might be related:


Everything else binds without error, for instance, using the rackID to get specific indirect tags.

But when I attempt to use the binds in the above expression, they do not take effect. The expression even properly evaluates in the expression preview.

I was thinking it had to do with load times for different frames which is why I tried binding it to the onStartUp, still no luck.

I resolved my problem by swapping from = to like in my expression.

from if ({view.params.rackID} = 3, true, false)
to if ({view.params.rackID} like 3, true, false)

I probably should have realized that the URL param would be passed as a string not an integer. My testing in the designer was by manually entering an integer in the param value.

I am a bit new to Ignition, still working on my debugging practices.

1 Like

Params passed as part of the URL will ALWAYS be strings. I suspect that if you modify your logic to compare against a string value of “3” (or if you cast rackID as an integer) that your bindings will begin displaying as expected.

Edit: I should have read all of the way to the bottom. I’m glad you figured it out.

you should use “3” instead and not like, as like might cause other things to return true aswell

It’s also, like, not as, like, efficient

1 Like