Subject Re: Filter for Date Range
From Andy Taylor <andy.taylor@which.net>
Date Wed, 21 Mar 2018 19:31:09 -0400
Newsgroups dbase.getting-started

Heinz,
Agreed. Me too.
Andy

> Hi Pat,
>
> > You are absolutely correct that dates are tricky.
> > However, your solution worked.  Using form.date = Dtoc((Date()))
> > and then a filter with the sequence single apostrophe, double apostrophe, and a plus sign on the front end and reverse on the rear end does work.
>
> When I first encountered such command lines where single and double
> quotes are so close together I found it quite a bit confusing and rather
> hard to read.
> By looking for a remedy I ended up by replacing one type of quotes with
> square brackets, which helped a lot, so I finally made it a habit to
> stick to this "way of spelling" for such kind of code.
>
> Thus, the line
>
> filter = "ddate >= '"+form.start+"' and ddate <= '"+form.end+"'"
>
> becomes
>
> filter = [ddate >= '] + form.start + [' and ddate <= '] + form.end + [']
>
> which is - at least for me - much easier to read, espicially when you
> review the code after more than half a year or so.
>
> Kind regards, Heinz