XY Chart query binding run twice every time

Good morning,

I have a problem, in my specific case with a XY Chart. I fill it up with a query binding where I pass 3 parameters:

  1. StartDate (DateTime)
  2. EndDate (DateTime)
  3. Department (Int4)

The problem is that when I select the StartDate or the EndDate, both of them change accordly with the shift so the query run twice, I guess because both are updated. For example if I change the StartDate, the EndDate will change automatically and viceversa.

What could I do to prevent it?

Do you mean that you have 2 date pickers, and picking the date from one changes the date from the other, using some shift duration to do date arithmetic ?
If that's the case, you have redundant information, which indeed will make the binding update twice.

Is the shift duration fixed, or is it pulled from somewhere ?

1 Like

Yes the 2 data pickers are 2 of the 3 parameters of the named query.

The problem is that the shift is fixed but you can even choose a daily view or other options.

I think that even if I pass only one parameter (maybe concatenating together the 2 date) I will have the same problem right?

There's no option in the binding to prevent a double binding in a very short time?

No, if you remove one of the date pickers then you will only have a single property triggering the binding.

I would not concatenate the two together. Make one date an offset of the other.

1 Like

I can't remove one of the data picker, I was thinking about passing a single parameter maybe with a custom properties of the 2 data pickers together.

Unfortunately the offset is not fixed.

Normally I have about 100 columns to show in the xy chart, but I have a specific department where there are 7-800 columns and load it twice is not the best.

Why not?

This statement:

Indicates that one time is dependent upon the other. That means that you only need one date picker.

1 Like

I usually use a datepicker for either a start or end date and a dropdown or radio group to select
Period: (o) 1 day ( ) 7 days ( ) 14 days 28 days
or whatever.
It means that once the period length has been selected the datepicker is only used once.

1 Like

I have this cases:

  1. Shift offset
  2. Daily offset
  3. Custom offset

The first 2 are selected by arrow and checkbox and depending of these the offset is 8 hours or 24 hours, the 3rd option is selected choosing start and end datetime manually.

Why not a start date and a number of hours, or minutes, or seconds, or even a combination?

Or even, use an expression with both of the date time pickers and calculate the offset, and use the offset in your binding, as opposed to the two different dates.

1 Like

This could be an idea..

What about this… using the

system.util.invokeLater

function to pass after maybe 100ms one single parameter to the named query and then manipulate this to extract start date and end date separately?

Only available in Vision Client scope, not perspective.

1 Like

Yes are all ideas, the starting point for me is to keep the things exactly as they are now, because is 25 years that people in production are used to run it with 2 data pickers so I would like to continue to keep in this way..

But I need to find a solution at this problem, because is crazy to load the same data twice with no reason.

I appreace all your helps, thank you guys

Oh ok, thanks

The solution is quite simple. Don't tie both date pickers to the same binding which triggers the query. That's it, that is the only solution. There are multiple ways to arrive at that.

I wouldn't oppose change just because it's different. Just because something works doesn't mean there isn't a better solution.

1 Like

I'm still a beginner with this stuff, so I hope I don't embarrass my self too much...

Could you use custom properties to pass the information to your query, and then have a script on a button's OnActionPerformed event to update the custom properties based on the values of the two date pickers?

What @Kevin_Flener said....or you could also display the start/end time as a label or button. On press, bring up a popup window to choose your start and end times (along with your other selections). When you click OK on your popup window, send a message to your main screen to update some custom start/end properties that are bound to your XY Chart.

Sadly, this is something that Vision's query bindings and Chart pens do (10ms? 50ms? something like that) that didn't get ported over to Perspective. :frowning_face:

Or maybe it is a side effect of Vision's single UI thread and the asynch nature of query bindings. But the end result is that Vision coalesces multiple reference changes that feed into another binding. Perspective doesn't.

I think this would be worth putting up as a feature request.

1 Like

Yes, that's what I mean.. It looks strange that this feature is not in Perspective..

As you guys suggested there are a lot of workaround to "fix" this problem but they are not the solutions, I mean add a button or add a dropdown is something more that the operators must do check the departments status and in terms of enhancing the tool, this is a step backward.

Sorry, but how is adding a button or a dropdown in lieu of a date picker "adding" something for the operators to do? You would be replacing one action with another.

1 Like

You are absolutely right, let's say that I understand the group's choice to keep everything as it has been for the last 25 years to ensure continuity even in the case of a revamp.

In any case, if there is no solution to the problem of double execution (even though, as suggested by @pturmel, it might be a "problem" that Inductive Automation could consider addressing), I obviously have to think of something different, probably substituting the date picker with a dropdown menu.