Article Preview
Buy Now
FEATURE
A Predicate For Data, Part 2
Completing the basic predicate model
Issue: 16.3 (May/June 2018)
Author: JC Cruz
Author Bio: JC is a freelance writer based in British Columbia. He is a regular contributor to MacTech Magazine and Dr Dobb's Journal. Away from the writing pile, JC spends quality time with his nephew, as a proper uncle should.
Article Description: No description available.
Article Length (in bytes): 33,332
Starting Page Number: 55
Article Number: 16305
Resource File(s):
project16305.zip Updated: 2018-05-09 11:00:09
Related Link(s): None
Excerpt of article text...
In my last article, I described how I designed and implemented a basic predicate model. Now I shall give that same model some much needed features.
I begin with an overview of SQL sorting and grouping predicates. Then I update the ModelPred class with support for those two predicate types. I add new methods for replacing and removing predicate data. And I modify a controller module to make use of the updated predicate model.
Readers need a working knowledge of Xojo, SQLite, and object-oriented design. The updated version of the demo project FooHealth (Mk12.1) is available from the magazine's website.
Sorting and Grouping with Predicates
As I stated in the previous article, sorting and grouping predicates work primarily with data queries. The
sorting predicate sets the arrangement of the query results. Thegrouping predicate sets the field to be filtered of duplicate results.The sorting predicate starts with the keyword
ORDER BY
. After the keyword is a sequence of field names, each name delimited by a comma. AnASC
keyword after the sequence will arrange the results inascending order , aDESC
keyword indescending order. By default, an SQLIte query arranges its results in ascending order.
...End of Excerpt. Please purchase the magazine to read the full article.