There are many situations where you need to display a list of records, and the system handles that 'out of the box' using a Query. When you embed the Query on a page, you get to say how many records get displayed at a time, and it handles all the navigation links between pages of the records.
That's fine if you want to show the same fields for each record, and show them in the same style, but what if you want to show some differently?
Why would you want to do this?
Here's a couple of examples:
1. A list of messages. Consider your email program. This shows a list of messages, but some – the new ones, are shown in bold, whilst the ones which you've seen before, ie marked as 'read', are not in bold.
2. Staying with lists of messages, say you have a public-facing forum, and you want some messages to show the name of the poster, whilst others are kept anonymous.
The first example is concerned with styling, whilst the second extends to a different selection of fields. The solution is the same:
Three queries and some criteria
Let's start with the criteria. We need to include in the Form some method of knowing which style is to be used for each record. This could be a checkbox field, where one style will be used if the checkbox is checked, and the other if it isn't, or we may be able to base our criteria on a field that already exists, for example we might use a date field and say all records older than a week should be shown in one style.
Once we have any criteria fields added in, and some sample data added so we can see what we're doing, we need to create our queries.
The first query, called "Q: Listing" is the one we'll embed on the final page. It should be based on our Form, and does not need any criteria applied to it for these purposes. It will manage the paging through all the records, and be in overall charge. When we embed it, we'll embed the Custom View.
The Custom view consists of no fields, but two embedded queries: "Q: Style 1" and "Q: Style 2", embedded straight after each other (no spaces or blank lines separating them).
Before we can embed them, of course, we need to create them, so create the two queries. These should also be based on the same Form, but their styling and displayed fields can be as different as you like. That's the whole point, after all. Be sure to include in these two queries any of the fields you need for your criteria. The fields don't need to be displayed, but they do need to be included as columns in the Fields tab.
Back in the Custom View of "Q: Listing", where we are embedding our queries, we need to add our criteria. These need to be mutually exclusive ie for each record, if a criteria is true for one query, it must be false for the other. (Otherwise you'll either miss out some records from the display, or you'll see the same record in both styles).
And you're done. Now when you embed the "Q: Listing", it automatically takes care not only of its own paging, but also ensures that each record is displayed in the appropriate style.
The examples above used two different styles, but there's no reason why you can't extend it to more – being careful with the criteria, which will get more intricate.