Named Query binded to datetime picker

Hello!

I have a Named query in a table binded to a datetime picker value.

SELECT 
 ..

    AND WO.WORKORDERDATE BETWEEN :StartDate AND :EndDate
GROUP BY 
    WO.WORKORDERDATE, 

...

The data time pickers has fixed values so there is something in the table when it loads.
image

It loads the data well but when I change the time on the datetime pickers doesn´t reload the specify Named Query.

Any idea how to make it work?

Those DateTime pickers seem to be inside flex containers. If that is so, it means that {../DateTimePicker_Start.props.value} can't be the correct path and the query should give an error.

You can start using parent.parent.getSibling.getChild.getUncle or, much better, create custom properties on the view, custom.dateTimePicker_start and custom.dateTimePicker_End.

  • Bind each datepicker to the view custom property. Make the binding bidirectional.
  • Edit the query binding to look at the custom properties. It will be simply view.custom.dateTimePicker_Start, etc.
2 Likes

You have scrollbars on the datepicker containers. You probably need to set height : auto.

1 Like

Great, thanks, now it works,

I adapt what you said, I added a custom property as bidirectional bind to the datepicker value.
I didn´t realize about the bidirectional binding at all.
image

The only issue is when the page loads the datepicker shows current date

image

instead the date by default
image

You have created custom.date on the datepicker. That doesn't help you. I recommend that you create it on the view.

Then, on view.custom.date create an expression binding:
now(0)

2 Likes

Thanks Transistor, I aplied your fix

Now I have 2 custom properties on my view so the datapicker show this values
image

I aplied the expression binding
image

Once the date format appear on the custom property I deleted the binding so I can put any date I need.
image

Cheers!

now(0) runs only once when the view is loaded. You can leave it there so that it gets today as start value every time.

now()     <-- executes at default scan rate.
now(0)    <-- executes once.
now(123)  <-- executes every 123 ms.

Tip:
Binding title bar

When showing screengrabs of the binding dialog, always show the title bar so that we can see what component the binding is on.

1 Like

Thanks,

The thing is the table is part of a report tool and the StartDate should be at least one year ago

image

midnight(addYears(now(0), -1)) will return one year ago at 00:00:00.

2 Likes

Ok, great!, thanks

image