I have a named query which fills the data of a Power table.
It receive two calendar values as parameters which comes from 2 Calendar controls (start date and end date)
Where or how can I check, before use the dates in the Query, that the second date is after the first date and that the number of days between both are < 31 days, and if they are wrong send a message to the user...
thanks
I would probably do this in an property change either just the second (end date) or maybe both date pickers.
After a date is selected in the end date picker, compare it's value to the start date, see if it's later and if not, show your popup.
Note that this won't stop your named query from running if it's a data Named Query binding on the table, but at least you will show a message why there are no records.
If you do not want to run the query at all unless this condition is met, you will need to do it with more scripting, but personally I think having the NQ run and get zero records and informing the user why - this is sufficient.
If I want to do more scripting to capture and evaluate all these, before run the NamedQuery and update the Powertable, where should it be...?
You would delete the references to the calendar controls in the NQ binding. Instead, reference additional (custom) properties to hold the "approved" start/end timestamps. Use change scripts on the calendars to check your constraints, and if OK, write both endpoints at once to the "approved" properties. That last will trigger a re-run of your NQ.
thank you