Suppose you want a Notes view that categorizes documents, but you don't want to
have the categories in alphabetical sequence.
Developers generally do this by adding a hidden sorted column before the
categorized column. An example of such a hidden column formula follows:
REM "Pre-sort documents to control order of categorization";
@If(Status = "Draft"; 1; Status = "Submitted"; 2; Status = "Completed"; 3; 4)
If this is followed by a categorized column that displays the Status field, the
Draft category will appear first, then the Submitted category, then Completed,
then any others in alphabetical order.
However, the hidden sorting formula is more complex than we like to evaluate in
a view, for performance reasons.
You could create a separate computed field in the document using this formula,
but this complicates automated processing of the documents (when an agent
changes the status it must also change the sorting number), and makes
maintenance more difficult since you can't easily reorder the view by changing
Here's a way to recapture some of that performance while avoiding storing extra
fields. Use the following as a column formula instead:
REM "Pre-sort documents to control order of categorization (values are listed
in reverse order)";
@Member(Status; "Completed" : "Submitted" : "Draft")
You would then need to sort the column in descending order (this assumes you
want unknown values to appear at the end).
This formula manages to produce the same result as the @If without doing three
separate comparisons, giving better performance. It's also is easier to
maintain, since to add a new value you just need to insert it at the correct
position in the list, instead of reassigning the number codes yourself.
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.