Step One: What determines the style?
How will CatBase decide how to format the data? There are several ways:
Let's look at each method ...
Choice List Fields
A Choice List field is a field that has a specific list of options attached to it. For example, your list might contain choices like:
- Plain
- Bold
- Logo
- Extended
Instead of entering data directly into a Choice List field, you click on the field and make a selection from a pop-up list - for example:
Choice List fields can be recognised by the fact that their names are underlined on a data entry form.
To create a Choice List field:
- Go to Table and Field Setup (click on the Setup button on the main window and choose Table and Field Setup)
- Select the appropriate table
- Either add a new field by clicking on the New Field button, or open an existing field by double-clicking on it. Note that only String type fields can be designated as Choice List fields.
- In the Field Properties dialogue box, select the Choice List check box
- Either select an existing Choice List or create a new one by clicking on the New List button
- For example:
- Save the Field Properties
To modify the options on a Choice List, click on the Setup button on the main CatBase window and choose Lists.
Check Boxes
A check box is a representation of a Boolean field type: it is True or False (or Yes or No). If the checkbox is checked, it's True; if it isn't, it's False. Check boxes have their uses but keep in mind that they are limited to just two choices - Yes and No! An example of using this option would be a"special offer" option.
Field Content
You can also tell CatBase to consider the contents of a field to decide how to format text or numbers. Here are some examples:
- If the Product Name contains "chocolate", set it in a dark brown style
- If the price is less than 10.00, set it in the "Bargain Basement" style
- If the country is not "USA", set it in a bold red style
- If the Enter Date (the date on which the product was added to the database) is greater than 01/01/2008, then set the product name in the "new product" style
The possibilities are endless!
Step Two: How do you tell CatBase what you want it to do?
That's what Formulas are for!
Formulas are one of the types of Element that are the building blocks of Paragraphs in your Publishing Style Sheets. To create a Formula:
- Open your Publishing Style Sheet (or create a new one)
- Open a Paragraph (or create a new one)
- Add a new Element
- Click on the Formula radio button. The Formula window looks like this:
Formulas enable you to set up rules that follow this pattern:
IF (some condition is met) THEN (do something) OTHERWISE (do something different) AND ALSO (optionally do something else as well)
Formulas are described in detail in another Tutorial. We will look at a couple of examples relevant to conditional formatting of text in this Tutorial.
Example One: Selecting the Paragraph Style depending on the options in a Choice List.
A typical use for this sort of thing is in a business directory. Everybody is entitled to a free entry, but they can pay extra to have an enhanced entry. Suppose we have a choice list called Listing Level, which offers the following options:
- Basic
- Bold
- Enhanced
- A Basic listing is the free option; their basic contact details are published, set in a plain font using a stylesheet called basicentry
- A Bold listing is a paid upgrade; they get their basic contact details set in bold using a stylesheet called boldentry
- An Enhanced listing is another paid enhancement; they get their contact details set in bold,using the boldentry stylesheet, plus a brief description of the product or service they offer.
The first line of detail for each listing contains the company name, set in the appropriate style (plain or bold). So, to publish the Company Name, appropriately styled:
- Create a Paragraph and select the basicentry stylesheet for that Paragraph
- Add an Element and select the Formula radio button
The decision that we want CatBase to make is this:
"IF the Listing Level is not Basic, THEN publish the company name using the boldentry stylesheet; OTHERWISE publish the company name using the default styles for the Paragraph (basicentry)"
So our Formula will look like this:
Note the change of style!
The Otherwise tab looks like this:
This is a simple example that shows how to choose between two styles; you can set up more complex decisions by creating multiple Paragraphs with different stylesheets selected, and then using the Include this Paragraph option.
Example Two: Selecting the Paragraph Style based on a Boolean field
This option works when you have a simple yes/no (or true/false) choice to make - for example, for products that are on special offer (either they are on special offer or they aren't).
In this case we would create a Special Offer field, which would be a Boolean type. It appears on the data entry forms as a check box. If it's checked, the product is on special offer and we want to set the product name in a special style (maybe bigger, bolder, and in red). If it isn't checked, then we want the product name set in the normal productname style. We would set up a Formula like this:
In the Otherwise area, Product Name is selected for Export Field.
Example Three: Selecting formatting based on a field's content
Use this method when you want to base a styling decision on the data that's in a particular field which is not as structured as a choice list field. You can do these comparisons on various types of field, for example:
- Date fields - if a person's date of birth is earlier than a certain date, they are over a certain age
- Numeric fields - if the value in a numeric field is less than a certain amount,, it's a bargain item
- Text fields - if the field contains a certain keyword, format it differently
Let's say we are publishing a catalogue of food products, and we want to highlight everything with "chocolate" in its name by setting it in a bold, brown style using a stylesheet called chocstyle. Our Formula would look like this:

Summary
As you can see, there are lots of ways you can get CatBase to make decisions about the styling of the data based on the content of a record. If you are not quite clear how to solve a particular styling problem, please contact us and we will help you figure it out.
