Use Indexing (the Index library)
We also frequently use a Index library to manage simple ordered lists of unique strings. For example, if you want to keep track of all the states that you have franchise locations in, you can use an Index rather than search through all 5,000 franchise locations to get the list of states you have franchises in. Every time a franchise is added or edited, just add the state to the Index, which will make sure it's in the list in the proper location, and not more than once.
You can also use multiple indexes to speed up frequent queries. For example, you can have an index for each state that contains all the franchises in that state.
The Index can be used as a simple in-memory JavaScript object, but it also supports storage in a Data entry with a simple save() function.
Get the code here. Here is a usage example (taken from the library's header comment):
// Add items to the index, which may or may not
// already exist. The items will be added only if
// they're not in the index already, and sort order
// will be maintained. Empty strings are ignored,
// and values should not contain line breaks.
var ix = new Index('myindex');
ix.add('item 1');
ix.add('item 2');
// Add will also accept an array of items:
ix.add(['item 3','item 4']);
// Nothing is permanent until save() is called.
// Save will only actually save if a change has been made.
ix.save();
// Access the array of items in an index - warning:
// changes made directly to this array will be saved.
var ix = new Index('myindex');
var array = ix.items;
// Query an index for the existance of an item
var exists = ix.contains('item 2');
// remove one or all items in an index
ix.remove('item 3'); // silent if item 3 isn't found
ix.removeAll();
ix.save();