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
Find and delete duplicate notes (Read 4445 times)
james a. foster
Full Member
*
Offline



Posts: 130

Find and delete duplicate notes
Sep 24th, 2013, 2:21pm
 
How do I find and delete duplicate notes? It is probably enough for my purposes to delete notes with the same name as some other note.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Find and delete duplicate notes
Reply #1 - Sep 24th, 2013, 5:23pm
 
Firstly, action code can't (by design) delete notes. So what about finding the duplicates.

An agent can find all notes that are 'duplicate' by dint of having the same $Name. But with aliases in the mix this can slightly hard as, by design, agents only find one instance of any note and all its aliases. But have you seen this and this in aTbRef? They might solve the 'finding' part of the problem.

Having found your 'original' notes, you could get an agent action to move them all to a new container and then open the later in a main view and delete all but one instance, then put it back in the same place.

There is very likely a more elegant solution to your problem but will relate more precisely to your specific document (which we can't see) and/or workflow. So, I'm sorry if the above seems overly generic.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
james a. foster
Full Member
*
Offline



Posts: 130

Re: Find and delete duplicate notes
Reply #2 - Sep 24th, 2013, 5:29pm
 
thanks for the pointers, and it is good to remember how to get past mistaking aliases for duplicates.

But I probably wasn't clear enough. I am making a database of all my publications, but have found that sometimes the same publication gets added more than once, either because the automation is strange or because the data-entry person screws up. I want to know when a publication gets added more than once.

So, the problem isn't that I am looking for duplicates for a particular note--yes, that is pretty easy. I'm looking for an agent that produces a list of potentially duplicated notes.

Does that make sense?
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Find and delete duplicate notes
Reply #3 - Sep 24th, 2013, 6:04pm
 
Fine, in that case an agent will find all instances. If there are 3 instances of "XYZ" then the query:

$Name==""XYZ"

Will get 3 matches. In Outline view, if you use columns to display $Container or $Path, it should be easy to spot the dupes. To locate the originals of notes to delete without losing the stating context (i.e. leaving the agent on view): select the alias of a note to delete, Cmd+Opt+O opens a new outline, Cmd+R shifts focus to the container of the alias' original. Now the original can be deleted and the extra outline closed. Rinse an repeat for each dupe to delete.
Back to top
 
« Last Edit: Sep 24th, 2013, 6:08pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Find and delete duplicate notes
Reply #4 - Sep 24th, 2013, 6:07pm
 
Doing the above a lot? Then make a re-usable agent. Add a String attribute $MyString. Create an agent and set $MyString as a key attribute. Now make the query:

$Name==$MyString(agent)

Set the agent's $MyString to "XYZ" or "ABC" or the name to de-dupe.  Once done, to de-dupe a new name, rather than make a new agent, simply change the agent's $MyString.

Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
james a. foster
Full Member
*
Offline



Posts: 130

Re: Find and delete duplicate notes
Reply #5 - Sep 24th, 2013, 6:10pm
 
This is very helpful! The reusable agent idea is a great trick to know, too.

Now, how do I loop over all possible values for "XYZ", without having to do it manually? The only ways I can think of are really clunky.
Back to top
 
« Last Edit: Sep 24th, 2013, 6:12pm by james a. foster »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Find and delete duplicate notes
Reply #6 - Sep 24th, 2013, 6:22pm
 
Scope the agent carefully to avoid irrelevant stuff (e.g. starting query with inside("My Data")) then sort the (agent) container in $Name. You'll get a title-sorted list of all notes in scope. Then just work through actioning the dupes as you go.

NOTE: the above approach is OK for a few hundred notes, but don't use if thousands are in scope.  You either need a finer query or to to the more manual way above.

Just turning in here, but a last thought as I go. You could use a rule or an agent action to make each note test to see if other notes use its $Name. If so, set a Boolean $IsDupe. Not an agent can query $IsDupe (sorted on $Name), and you can then work through a list of only duped notes. Once dupes are deleted, you can clear the $IsDupe setting (in case you need to repeat the process later)
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
james a. foster
Full Member
*
Offline



Posts: 130

Re: Find and delete duplicate notes
Reply #7 - Sep 24th, 2013, 6:33pm
 
As usual, excellent advice. Will do.

Thanks!
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print