refreshBinding not working with Embedded View params

I have an embedded view which has a param called "value". This value has a Tag History binding, that works perfectly when the page startup. However, as this value doesn't update by itself, I added message handler to receive a msg from a timer, and inside the message handler I have this:

self.refreshBinding("props.params.value")

No error on the gateway logs, and the message handler is working because I also added the system.perspective.print and I can see it being called.

Thank you in advance for your help.

View parameters are only read on initial loading of the view.

One way to fix it would be to create the binding on a session variable and have the embedded view reference that. How well this would work for you depends on the structure of your project.

So I created a custom variable called goodCount, and pasted the view param "value" binding to it, and referenced the params "value" to it. Now my refresh binding is:

self.refreshBinding("custom.goodCount")

However, it still doesn't seem to work.

Sorry, it's not clear what you have done there. Can you show a screenshot of the binding and paste any code code (using the </> formatting button).

Of course. I'm sorry for the confusion.

The custom.goodCount now has the Tag History binding, while the params.value is pointing to it.

My self.refreshBinding is pointing to this custom.goodCount now, instead of the params.value.

And this is the Tag History binding.

Let me know if it was clear, and thank you for your time helping me with this.

Thanks. The way that's set up at the moment you might as well apply the binding directly to params.value as it's just a copy of custom.goodCount.

Silly stuff checklist:

  • You can't create a message listener on props.custom so you're listening on props.params.value, I presume.
  • If you're running self.refreshBinding on props.params.value then you can't expect an update as all you're doing is copying whatever was already in custom.goodcount. You need to refresh custom.goodcount instead. This is another good reason to move the binding to params.value directly as then the self.refreshBinding would work.

When I first posted this problem, I didn't have the custom variable. I created it because you said "View parameters are only read on initial loading of the view." and as I had a self.refreshBinding("props.params.value"), and it wasn't working I created this custom variable to use the self.refreshBinding on it, which didn't work either.

I found out that the problem is that the refreshBinding doesn't update the now(0) variable in the End Date within the Tag History binding, and that was the problem.

The refreshBinding was pulling the same data because the now(0) didn't change, it kept the same value from the startup.

I think this is a bug when using now(0) in those dates and refreshBinding function doesn't update its value.

I didn't notice that you were using now().

You can fix that easily bearing the following information in mind:

  • now() will execute at the default rate of every 1000 ms. (This is probably too often for a history query.
  • now(0) will execute once.
  • now(123000) will execute every 123 seconds.

https://docs.inductiveautomation.com/display/DOC80/now

That solved my problem. I don't even need the refreshBinding anymore.

Thank you very much!

What was your solution? My embedded view only updates on load. Tag values change and the display is not updating.

Paulo, can you click the Solution button on the answer that worked? Thanks.

Read back through the posts. Post #2 explains that view parameters are only read on initial loading of the view. Read the rest of the posts to see some possible solutions.

If you are still stuck then you'll have to show us your configuration.

1 Like

Here refreshBinding is defined in the wrong place.

self.props.refreshBinding("params.value")
1 Like

So I have a Dashboard on the screen. Those tag items with parameters are updating as expected. Will see if I can come up with a way to refresh the bindings. What allows the Dashboard to function correctly?

In my image the red x item the status is only changing on load. The green checkmarks items update normally on changes.

Screenshot 2024-02-07 092650

Where does the data for that red item come from ?
What should trigger its update ?

2 Likes

I have a binding on it.

I have other text fields that are referencing a parameter directly that don't update. Which are basically passing tags.

Expression on the image object:
if(toBoolean({view.params.SiteStatus}),"/system/images/Icons/cow_grn.png","/system/images/Icons/cow_red.png")

So the issue here is that the whole thing depends on a parameter. As explained before, parameters do not update.

How is that status passed to the view ? You could either make that dynamic, or move the logic that evaluates the status to INSIDE the view.

The whole thing really depends on how that status is computed.

2 Likes

I see. I will try to pass the tag path and not the actual status.

The previous screen is a map. Each location you select passes parameters to the next screen. The information screen in my screenshot then populates based on the location data in the params.

1 Like

That worked. I added a numeric field and use that to monitor the tag value. I pass the Tag Path in my parameter. Been using Vision forever. Perspective is pretty tricky.

Screenshot 2024-02-07 094814