Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Basic question about using tags (Read 2873 times)
Greg Korgeski
Full Member
*
Offline



Posts: 89
Vermont
Basic question about using tags
Aug 10th, 2014, 1:58pm
 
This might be obvious to others but I'd appreciate some help. I'm not sure I understand how to use tagging. I set up a User attribute for Tags. When I write a note, even perhaps a paragraph long, there may be several things in it that I'd like to be able to locate later, even if they are not the main subject of the note, so using tags seems to make sense. For instance, the note might refer to a friend named Mary, so I create a tag named "Mary."

The problem is how to use this if I try to enter several tags into the list of tags for the note. E.g., should I separate them with semicolons, commas, ?

What about later, when searching for all notes that have a particular tag, especially if there are multiple tags that have been "clumped" together in some notes. In this example, in the attribute browser, the name "Mary" is easy to find, but if I have many tags and note has, say, been tagged with several tag terms (e.g., "elephants; Mary; politics"), scrolling down the attributes list results in finding only notes that have "Mary" and others that have "elephants; Mary; politics" -- instead of listing every note that has the word "Mary" tagged. Alternately, using a Find command (Find: Mary) yields perhaps dozens or even hundreds of notes in which the word "Mary" appears, but perhaps only a few were ever tagged.

I'm sure I'm missing something.. help appreciated.  Thanks.
Back to top
 
 
  IP Logged
David Bertenshaw
Full Member
*
Offline



Posts: 182

Re: Basic question about using tags
Reply #1 - Aug 10th, 2014, 3:09pm
 
This is a very simple and quick answer, but I hope it'll help you get started.

First of all, make sure that your user attribute "Tags" was set up as a 'set', not a 'list' or 'string'. Lists and sets are both multi-value attributes, but sets make sure that each value is unique, which is what you need here.

To add multiple values to Tags, you enter them separated by semi-colons e.g. Tag1;Tag2;Tag3 etc. Notice that there's an arrow with a drop-down menu next to the attribute for quick selection of tags.

There are a number of ways in which you can look for the tag values once you've entered them.

The simplest is to use the Attribute Browser (View > Attribute Browser or cmd-opt-A). This allows you to see all the notes which have a given attribute, sorted into values.

In your case, choose User and Tags from the drop down lists at the top of the view -- you'll see all your notes sorted alphabetically by tag. Notes with more than one tag are listed more than once, and you can add tags to a note by dragging it to the appropriate line.

Slightly more complex: you write an 'agent' which creates a new container with aliases (basically dynamic copies) to all the notes that meet the criteria.

In this case, in an outline or map, press Create Agent (cmd-shift-A) and in the popup that appears, enter the Query field and type

Code:
$Tags.icontains("Mary") 



You'll see that the agent note has gained a lot of children -- all the notes which have "Mary" as a tag. The query language is very powerful -- you can search for all notes containing Mary that were written in the last seven days but which don't have the tag "Peter", and so on.

Have a look in the Help file under Agents -- it'll point you to the Tinderbox 5 help, but that's still largely current for these purpose.

Mark Anderson, a user on this forum has a really helpful set of tutorials at http://www.acrobatfaq.com/tbdemos/clarify.html which it's worth looking through.

As I said, a quick rush through, but I hope it's given you a few pointers.
Back to top
 
 
  IP Logged
Greg Korgeski
Full Member
*
Offline



Posts: 89
Vermont
Re: Basic question about using tags
Reply #2 - Aug 10th, 2014, 7:16pm
 
Thanks, David. That makes sense of the problem. Using the attribute browser method of looking for the tagged notes, after going into "Inspect stamps" to "User" and changing tags to a set, the current, new tag "Mary" works as it should in the attribute browser (it gathers both the note with just the tag "Mary" and the one with the other terms in the tag set as well.) It also turns up just fine via an agent.

Unfortunately, I've got a few hundred notes created with tags that were done as strings... neither method seems to turn up the "middle" term if, say, I erroneously used a set of three would-be tags. Might need to find a way to fix those at some point.

Appreciate the help.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Basic question about using tags
Reply #3 - Aug 11th, 2014, 4:23am
 
Quote:
with tags that were done as strings

If, for instance, you had previously added data to $Tags as comm-separate lists, e.g. 'orange, lime' or 'banana,kumquat' then that can be fixed with a replace() operation. Let's assume note X has these $Tags values:

apple
orange, lime
prune


If you were to look at the $Tags for X as a key attribute you would see the values a single string "apple;orange, lime;prune" with semi-colons as value delimiters (in the key attribute box you won't see the quotes). Thus you need to replace all instances of comma+(optional)space with a semi-colon to restore 'lime and 'prune' as discrete list values.

Important: I'm making an assumption that there are actually no real values that actually contain a comma.

Make a new agent to find all notes with a current $Tags value. Use this query:

$Tags

In TB regular expression terms the latter is ", *", i.e. comma followed by zero or more contiguous spaces. So the required action is:

$Tags = $Tags.replace(", *",";")

Check the data and then you can delete the agent (no point keeping/running it now the task is done).

The above is tested in v6.0.2 and results in all 'bad' comma-delimited and comma+space-delimited items being broken into discrete set values.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Greg Korgeski
Full Member
*
Offline



Posts: 89
Vermont
Re: Basic question about using tags
Reply #4 - Aug 11th, 2014, 1:27pm
 
Thanks, Mark! This looks very helpful.

Greg

9:58 PM (US EDT):  Follow up: worked like a charm. Thanks again! G
Back to top
 
« Last Edit: Aug 11th, 2014, 9:59pm by Greg Korgeski »  
  IP Logged
Pages: 1
Send Topic Print