icon picker
Tags & Categories

What this is:

When you want to allow a user to attach a descriptive word or phrase to something. Some examples: a type of animal, a model of car, a color, a genre of film, a type of food...

Why this is tricky:

Most app owners start out thinking they want to offer a short list of options for this, so they create an option set with their list of options. This is very easy to manage and work with.
But then as their app grows, users want more options, and the developer finds themselves adding to the option set and it becomes too big, and eventually they want users to be able to add their own. But option sets don’t allow for that.
Let’s say you begin with a Data Type instead of an Option Set - this is great, but how do you handle users adding new items to the list? If I add an item, will another user see it? Or is it just mine? What if I add an item I didn’t realize was already on the list, and now there are duplicates?
Very quickly, this scenario can get out of control and your app’s tag list can be a big useless mess.

How I do it:

Let’s just work with the concept of “Tags” and forget about Categories for a minute. (The concept I’m outlining is the same for both.)
Create a “Tag” data type. No option sets here. Here are your fields:
Field Name
Field Type
DT/OS
List
Notes
Display
What the tag is called
Status
(see example options below)
Type
Whether it was user-generated or provided by your app.
Owner
If user-generated, which user?
Merged Into
If a tag was a duplicate, which tag was this tag (and related data) merged with?
No results from filter
And here are the options in the option sets listed above:
Options: Tag Types
Display
Notes
System
User-Generated
No results from filter
Options: Tag Statuses
Display
Notes
Visible
Archived
Merged into Other Tag
No results from filter

What to do with this:

Before you launch the app, you populate your database with all of your tags (you’ll want to have them in both live and dev), marked with Type=System and Status=Visible, Owner=[empty].
Build out some UI and logic for people to create their own tags. When those are created, mark Type as User- Generated and add the user to the Owner field.
Your search when you show tags to a user will be a merged list:
Do a search for tags where Type=System and Status=Visible :merged with Do a search for tags where Owner=Current User and Status=Visible :sorted by Display (decending=no).


Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.