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
Using an agent to make a no-dupes ordered list (Read 864 times)
Scott Heftler
Full Member
*
Offline



Posts: 33

Using an agent to make a no-dupes ordered list
Dec 17th, 2015, 6:40pm
 
Is there any way to filter duplicates from an agent?

I want to only include one note for every value of $myString. Every note with the same $myString value happens to have the same $myNum value. I'm looking to create a duplicate-free list, either in the text of the agent or as its children, that shows $myString and $myNum, and sorted by $myNum.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Using an agent to make a no-dupes ordered list
Reply #1 - Dec 18th, 2015, 3:41am
 
I'd sort the agent on $myNum.  Then I'd use a rule in the agent to collect $myString, dedupe via .unique, format the list to one-value-pert line text and pass to $Text. Such a rule might be:

$Text=collect(children,$myString).unique.format("\n");
Back to top
 
 

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



Posts: 33

Re: Using an agent to make a no-dupes ordered list
Reply #2 - Dec 30th, 2015, 9:04pm
 
Thanks Mark for your elegant solution. The final form I used:

$Text=collect(children,$kStrain.format("/")+":\t"+$kGap).unique.format("\n");

I adjusted the $Tabs and the list looks great.

I had no idea that unique even existed.
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print