Initially, it should open - the current month, and by buttons - the current year and return to the current month.kev1n wrote:Should the form display all records when opened? Then you would this "OR LOCATE( ..." condition in your where clause that I posted earlier.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Search when opening a form.
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: Search when opening a form.
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: Search when opening a form.
When the form is first opened the Hash Cookie #year_filter#' doesn't exist and hence will not be replaced with its value.
Therefore if your WHERE clause looks like this
you will have to change it to something like this:
Therefore if your WHERE clause looks like this
Code: Select all
WHERE
(( DATE_FORMAT(p_dat,'%Y-%m') LIKE '#year_filter#'))
Code: Select all
WHERE
(
( LOCATE('#', '#year_filter#') = 1
AND YEAR(your_date_column) = YEAR(CURDATE())
and MONTH(your_date_column) = MONTH(CURDATE())
) OR
(
DATE_FORMAT(p_dat,'%Y-%m') LIKE '#year_filter#'
)
)