Need help (yet again) with filter {match}

48 views
Skip to first unread message

Tony K

unread,
May 26, 2020, 7:15:31 PM5/26/20
to TiddlyWiki
relevant portion of the code below


<$vars lastEntry="""{{{ [<Content>split[<br />]!is[blank]last[]] }}}""">        
        <$list filter="[
<Content>split[<br />]!is[blank]]" variable="entry">
                <
<lastEntry>> <$text text=<<entry>>/> <br>
                <$set name=isLast  filter="[
<entry>match<lastEntry>]"  value="true" emptyValue="false">
                    <
<isLast>>
                </$set>
         </$list>
</$vars>

lastEntry is the last split of <Content> with <br />

<Content> is being split with <br /> and being fed into a variable entry

for each entry i am comparing <<lastEntry>> with <<entry>>, I want to set isLast to true when it is the last entry 

needless to say i can't get it to work :)

thanks 

TonyM

unread,
May 26, 2020, 7:35:26 PM5/26/20
to TiddlyWiki
Tony

It can be helpful to state what you want to achieve separate from the partial solution that has a problem.

However I think what you are trying to do may be a common need, 

could you restate what you want, its easier than me reverse engineering first?

Regards
Tony

Eric Shulman

unread,
May 26, 2020, 8:54:27 PM5/26/20
to TiddlyWiki
On Tuesday, May 26, 2020 at 4:15:31 PM UTC-7, Tony K wrote:
relevant portion of the code below
<$vars lastEntry="""{{{ [<Content>split[<br />]!is[blank]last[]] }}}""">        
        <$list filter="[
<Content>split[<br />]!is[blank]]" variable="entry">
                <
<lastEntry>> <$text text=<<entry>>/> <br>
                <$set name=isLast  filter="[
<entry>match<lastEntry>]"  value="true" emptyValue="false">
                    <
<isLast>>
                </$set>
         </$list>
</$vars>
lastEntry is the last split of <Content> with <br />

You have tripled-quotes around the lastEntry value.  This make it a literal string containing the text of the filter itself.  Removing those will allow the "inline filter" to be evaluated.

enjoy,
-e

Saq Imtiaz

unread,
May 27, 2020, 1:56:45 AM5/27/20
to TiddlyWiki
@TonyK

Use triple or single quotes for filter= assignments as they are strings.

But when passing a filter to a normal parameter you need no quotes and the triple braces to indicate that the parameter should be interpreted as a filter and not a literal string

Tony K

unread,
May 27, 2020, 6:20:59 AM5/27/20
to TiddlyWiki
@TonyM

I always try to explain but still fails to :) sorry about that I will get better with time 

Thank you 

@Eric @Saq
that was it !!! thanks a lot

TonyM

unread,
May 27, 2020, 8:36:19 AM5/27/20
to TiddlyWiki
TonyK

That is OK, I could have done a rudimentary second set of eyes for syntax issues.

As long as we solve each others problems in the end.

Tony
Reply all
Reply to author
Forward
0 new messages