My example can be found here:
http://www.strm.us/tw/cigars.html

Still not having any luck with the one liner . . .

Thanks,

Mike

On Feb 14, 4:20 pm, "Mark S." <[email protected]> wrote:
> Hi Mike,
>
> "newArray" was supposed to be two terms: new Array
>
> The array.contains(...) method isn't part of the original JS spec.s --
> its part of the TW library. I've noticed sometimes in this context
> that anonymous objects (strings, in particular) revert to the base
> code lacking the enhanced TW methods. Forcing the JS to make the
> objects seems to be the ticket. Which is probably why your revised
> approach, making the array with its own variable, works.
>
> Good luck!
> Mark
>
> On Feb 14, 1:04 pm, Mike <[email protected]> wrote:
>
> > ReferenceError: newArray is not defined
>
> > My Current Code is:
>
> > {{center{<script>
> > var tids=store.getMatchingTiddlers("Cigar && ! excludeLists && !
> > Trash","modified").reverse();
> > var rr=tids.length
> > //wikify('<br>' + rr + ' raw array items' + '<br>', place); /%check
> > Raw Array%/
>
> > var fmt='[[%0|%0]]'; /%Needed for clickable results%/
> > var filter=[];
> >         for (var i=0; i<rr; i++) {
> >                 var val1=tids[i].title;
> >                 if (store.getTiddlerSlice(val1,"PersonalRank") < 9)
> > continue;
> >                 if (store.getTiddlerSlice(val1,"PersonalRank") == "Not
> > Rated")
> > continue;
> > //      var val=store.getTiddlerSlice(val1,"Purchased");
> > //      var choices=["Yes","yes","Y","y"];
> > //              if (!choices.contains(val)) continue;
> > //      if
> > (["Yes","yes","Y","y"].contains(store.getTiddlerSlice(val1,"Purchased")))
> > continue;
> >         if
> > ((newArray("Yes","yes","Y","y")).contains(store.getTiddlerSlice(val1,"Purchased")))
> > continue;
> >                 filter.push(fmt.format([val1]));
> >         }
> > filter.join('\n');
> > var ra=filter.length;
> > //wikify(ra + ' filtered array items' + '<br>', place); /%check
> > filtered array%/
>
> > var out=[];
> >         if (!filter.length) out=["No Cigars found"];
> > var ry=Math.floor(Math.random()*filter.length);
> > wikify(filter[ry] + ' {{small{(random cigar rated 9 or above) ' +ry
> > +'/'+ra+'}}}', place); /%Final Results%/
> > </
> > script><script>setTimeout("config.refreshers.content(document.getElementById('fD'))",
> > 60000);</script>}}}
>
> > Will upload the TW when I get home (Wednesday)
>
> > Thanks !
>
> > Mike
>
> > P.S. The (3) Liner works fine . . .
> > //      var val=store.getTiddlerSlice(val1,"Purchased");
> > //      var choices=["Yes","yes","Y","y"];
> > //              if (!choices.contains(val)) continue
>
> > On Feb 14, 12:59 pm, "Mark S." <[email protected]> wrote:
>
> > > It might be that this ...
>
> > > if
> > > (["Yes","yes","Y","y"].contains(store.getTiddlerSlice(val1,"Purchased")))
> > > continue;
>
> > > needs to be this ...
>
> > > if
> > > ((new
> > > Array("Yes","yes","Y","y")).contains(store.getTiddlerSlice(val1,"Purchased")))
> > > continue;
>
> > > If you have your code with a sub-set of sample data somewhere like
> > > tiddlyspot, then perhaps one or more of us could look it over.
>
> > > Mark
>
> > > On Feb 13, 3:16 pm, Mike <[email protected]> wrote:
>
> > > > Thank You !
>
> > > > 1st option works perfect, 2nd option (one liner) returns
> > > > undefined. . .
>
> > > > Any benefits of return vs wikify? (Other than they are both better
> > > > than document.write)
>
> > > > I appreciate your input,
>
> > > > Mike
>
> > > > On Feb 13, 2:39 pm, Eric Shulman <[email protected]> wrote:
>
> > > > > > Is their a way to put multiple conditions on one line I.E.
> > > > > >                 if (store.getTiddlerSlice(val1,"Purchased") != "Yes,
> > > > > > yes, Y, y") continue;
>
> > > > > var val=store.getTiddlerSlice(val1,"Purchased");
> > > > > var choices=["Yes","yes","Y","y"];
> > > > > if (!choices.contains(val)) continue;
>
> > > > > or.. .written as one line, without temp variables:
>
> > > > > if
> > > > > (["Yes","yes","Y","y"].contains(store.getTiddlerSlice(val1,"Purchased")))
> > > > > continue;
>
> > > > > enjoy,
> > > > > -e
> > > > > Eric Shulman
> > > > > TiddlyTools / ELS Design Studios

-- 
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.

Reply via email to