Hi,
MVD uses a subset of the features that Delphi (or Pascal) and SQL offer. That's not a criticism of MVD in anyway (I think it's an amazing bit of software) but it does mean that it can be a bit confusing if you find something that 'works' in Delphi, for example, but when you come to try it in MVD, it's a feature that hasn't been incorporated.
As such, I wonder whether any sort of reference books might add to the confusion.The bits of MVD that I've learned about have all been picked up from this Forum and from the MVD Help system.
With regard to your specific question about filtering by age,
1. hard coding the criteria as part of the tablegrid filter is fine provided it's never going to change.
2. if it is liable to change, you're always better off using a filter that you can apply at run-time by using the 'search' option, the 'sql query' option or writing a bit of script. Please have a look at the attachment as a way of using a variable filter with the 'search' option.
3. for an 'age' related query such as yours, a calculated field is, I believe, the right option. But one drawback is that it only performs the calculation once a record has been saved. To get around that, you can add a small script which, if the action is 'newrecord' then it can show the age before the record has been saved which is a bit more user friendly. It's still a calculated field, but just getting around the issue of it not immediately displaying (again, have a look at the attachment).
You also asked if the calculated field in the previous example was scripted SQL - well, not exactly! What you find is that:
1. the list of available commands is limited when using calculated fields and the syntax can be a bit different
2. the list of available commands is greater when using 'sql query' and the syntax is similar to writing scripts
3. the list of available commands is greatest when writing scripts.
I guess it's just a case of using the best tool for the job.
Hopefully, the above has explained things a bit rather than confounded them!! But any questions, just ask and someone will usually be able to help out.
Derek.
Post's attachments age filter2.zip 339.65 kb, 431 downloads since 2021-12-11