wissel.net

Usability - Productivity - Business - The web - Singapore & Twins

Single category views and tagging


Tagging is en vogue and its proponents see it as alternative to the classical folder approach. One alleged advantage of tagging is that you can have multiple tags but only one folder where a document is in. That's true for the file system and certain other mail applications but neither for Lotus Notes nor gMail. In gMail there is actual no differentiation between folders and labels (as they call the tags). What is new - and I like that a lot are better visualisations for folders/labels/tags: The infamous tag cloud and little labels in views and document denoting how it has been tagged.
In Domino showing documents with a certain tag is as easy as having a single category view with the tag field (that would be multi-value) as category. Not so fast. One of the really nice UI features of tagging is the ability to drill down: first show all documents that are tagged by one label, then by two etc. So our single category view needs to show all the combinations. So I gave it a first stab. This is what I came up with (note: the field name for the tags in "Tags" and they are space separated):
  1. @If (Tags= "";@Return ( "#no Tags" ); "" );
  2. trueTags := @Sort (Tags );
  3. results := "";
  4. tagCount := @Elements (trueTags );
  5. @For (n := 1;n < tagCount;n := n + 1;
  6. workElement := trueTags [n ];
  7. workTag := @Implode ( @Subset (trueTags;n ); " " );
  8. workList := @Subset (trueTags;n-tagCount );
  9. set1 := (workElement + " " ) *+ workList;
  10. set2 := (workTag + " " ) *+ workList;
  11. set3 := @Subset (trueTags;n ) *+ ( " "+ @implode (workList; " " ) );
  12. results := results : set1 : set2 : set3
  13. );
  14. @Trim ( @Unique (trueTags:results: @Implode (trueTags; " " ) ) );
You could sprinkle in some @Lowercase if that makes sense for you.
  • In line 1 I weed out untagged documents. Depending on the business requirements you might want to weed them out in the view selection formula, so you can skip line 1.
  • In line 2 the tag names get sorted, since that looks much better further on.
  • The loop from line 5 to 13 builds different combinations of tags (I wonder if I got them all covered).
    • Line 6 gets the current tag in the loop
    • line 7 the current tag plus as its ancestors as a single string
    • line 8 grabs the rest of the remaining elements
    • In line 9, 10 and 11 the two elements are then combined with each remaining element in the list (the *+)
    • and appended to the result in line 12
  • Line 14 adds the individual elements as well as the concatenation of all of them to the final result
Check it out if it works for you. Ideally the tag cloud would adjust too only showing the possible tags for the existing selection - but that's subject to an XPages post about the tag cloud.
As usual YMMV (waiting for the howling about 40k limits)

Posted by on 12 October 2011 | Comments (0) | categories: Show-N-Tell Thursday

Comments

  1. No comments yet, be the first to comment