Topic: Query Adjustment: Filtering Grid Results by Year and Month-Year
Hi everyone,
I just have a question regarding my query. I want to have a query to filter some results in my grid based on a date time picker data.
This is my current query in a calculated field in the database and it works like a charm:
bookings.monthly_fee * ROUND((JULIANDAY('now') - JULIANDAY(start_date))/30) - (SELECT ifnull(SUM(amount),0) from payments where payments.id_bookings = bookings.id)
Now I want to filter based on the year only and month-year instead of the current date. This means when I select the year only, the query should change the current date to the last day of that year. Similarly, when I select a month, it should set the current date to the last day of that month in the selected year.
How can I do it?
Additionally, how can I utilize the DateTimePicker component value in an SQL query form? I mean without any script. Alternatively, if I have to use scripts, how can I pass the results to my grid to display them?
Many thanks and have a lovely day!