Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 16.3 ('XDC 2018')
Instant purchase and download via GumRoad!

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):

Download Icon 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. The grouping 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. An ASC keyword after the sequence will arrange the results in ascending order, a DESC keyword in descending order. By default, an SQLIte query arranges its results in ascending order.

...End of Excerpt. Please purchase the magazine to read the full article.