Thought about using the hash compact method the other day ... can't remember why I didn't pursue it.
Anyways, you're not using the object generated by the funtion. Try changing this: eliminateDuplicates(arrToClean); out.push(clean); to this: out = eliminateDuplicates(arrToClean); Mark On Nov 25, 3:51 am, Alex Hough <[email protected]> wrote: > I've found a way to eliminate duplicates from an array [1] and applied it to > my code. I am not familiar enough with functions to know why it does not > work, but think that it is a simple solution. > > the script is below > > Alex > > [1]http://stackoverflow.com/questions/840781/easiest-way-to-find-duplica... > > <script> > > function eliminateDuplicates(arr) { > var i, > len=arr.length, > clean=[], > obj={}; > > for (i=0;i<len;i++) { > obj[arr[i]]=0; > } > for (i in obj) { > clean.push(i); > } > return clean; > > } > > var arrToClean=[]; > var out=[]; > tids=['Q1','Q2','Q3','Q4','Q5','Q6']; > for (var i=0; i<tids.length; i++) { > var t=tids[i].title; > var score=DataTiddler.getData(tids[i],"score"); > var val=store.getValue(tids[i],"primary"); > var val1=store.getValue(tids[i],"secondary"); > var filter="[tag["+val.readBracketedList().join("]][tag[")+"]]"; > var filter1="[tag["+val1.readBracketedList().join("]][tag[")+"]]"; > var > list=store.filterTiddlers(filter).map(function(t){return"[["+t.title+"]]"}); > var > list1=store.filterTiddlers(filter1).map(function(t){return"[["+t.title+"]]"}); > > arrToClean.push(list.concat(list1)); > > } > > eliminateDuplicates (arrToClean); > out.push(clean); > return out.join("\n"); > </script> -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.

