How to Create "First Letter" Subheadings

Updated: Jan 22


When publishing something like a directory, it's often desirable to insert single-letter subheadings to separate the entries into groups with a single-letter heading.

This is easy to achieve with CatBase.

  1. Download our free script "FirstLetter" from the Downloads page (in the Freebies section).

  2. Install the script in your CatBase database:

  3. Go to the Admin main tab.

  4. Expand the Database Setup topic on the left of the window.

  5. Select the table that you want to apply the script to.

  6. Select the checkbox Run a script when a record is saved (underneath the list of fields).

  7. Click the View/Modify Script button next to that checkbox.

  8. Click Import a Script.

  9. Locate the FirstLetter script and double-click it to select it.

  10. Click the Save button. DO NOT attempt to modify the script! You'll break it!

  11. With the table still selected, click the New Field button.

  12. Enter the field name First Letter. It must be spelled exactly like that, although it isn't case-sensitive.

  13. Select the Indexed checkbox.

  14. Save it.

  15. Click the Save button.

  16. Now whenever a record in that table is saved - whether it's a new or modified record - the first letter of the Key Field will be copied into the First Letter field.

  17. Update your existing data:

  18. Go to the table's main tab (where you see the list of records for that table).

  19. Click the Show All button.

  20. Click the Search & Replace button.

  21. Set up the Search & Replace dialog like this:

  1. NOTE! Make sure you enter something into the Change To: text box. We've used an "A" here - it doesn't matter, becasue the script will update it as appropriate for each record.

Click OK, then click Yes in the Confirm dialog.

All the records will be updated.

  1. Update your Publishing Stylesheet:

  2. Open the Publishing Stylesheet that you want to apply the sngle letter subjeadings to (or create a new one).

  3. Add a new Paragraph and make sure it is the first Paragraph in the list (click and drag it into position if it isn't)

  4. Name it something creative such as "Letter subheading" and choose the Paragraph Style that you want these subheadings to be set in, then Save that Paragraph.

  5. Add an Element to the new Paragraph.

  6. Select the field: First Letter for that Element.

  7. Go to the Preferences tab in the Element window.

  8. In the Options area, select the checkbox labelled Unique Group Entry. This tells CatBase that you only want to publish this Element ONCE for each group.

Also select the first checkbox, Omit Paragraph if this Element is blank.

Save the Element.

  1. With the Publishing Stylesheet still open, go to the Preferences tab.

  2. You need to modify the existing Sort Order, or create a new one. You must have the First Letter field as the first item in the sort list. (For more info about Sort Formats, see the Sort Formats tutorial.)

You're done! When you publish your data using that Publishing Stylesheet, it will be sorted first by the First Letter field and then by whatever other fields you've selected (probably the Key Field).

#publishing

56 views
crown commercial service logo
Adobe technology partner logo
4D silver partner logo
  • Facebook Social Icon
  • Twitter Social Icon
  • YouTube Social  Icon

© Copyright 2019 CatBase Publishing Systems Ltd.