[TW5] how to get the list of fields of tiddler with value "yes"

638 views
Skip to first unread message

Siniy-Kit

unread,
Apr 16, 2015, 8:31:43 AM4/16/15
to tiddl...@googlegroups.com
hi! I have a tiddler $:/_allvendors   with several fields sony="yes" Nikon="yes" dell="yes"  and so on.
how can I  collect all fields with "yes" value and render this tiddler into DOM and get macros <<allvendors>> to use it in filter [vendor[sony]][vendor[dell]][vendor[Nikon]]

Jed Carty

unread,
Apr 16, 2015, 1:16:10 PM4/16/15
to tiddl...@googlegroups.com
I have been trying to find a way to do that directly for a while and haven't been able to come up with anything. You can use how I made the options checkboxes work on this site. Each checkbox puts the filter part associated with that box in a field when checked, and makes the field blank when unchecked, then to make the final filter you concatenate all of the filter strings together.

It is a roundabout way to do it, but I am starting to doubt that there is a direct way with what is currently available.

In the proud tradition of engineers everywhere: if you are given an impossible problem to solve, cheat.

Siniy-Kit

unread,
Apr 20, 2015, 9:19:36 AM4/20/15
to tiddl...@googlegroups.com, jeremy...@gmail.com
Thank you Jeremy. Your macros is working, but I don't know how to modify it to my proposes  (I try many variants)
my idea was to make a list of checkboxes,

<$list filter="[is[current]tagging[]tag[$:/Note]each[vendor]get[vendor]]" variable="vendor">
<$checkbox tiddler="$:/_allvendors" field= <
<vendor>>   checked="yes" > ''<<vendor>>''  </$checkbox><br>
</$list>


the position of checkboxes I save in $:/_allvendors tiddler in its fields. so, If  the checkbox of vendor Dell is checked (unchecked), I want o remove from list all tiddlers with  field vendor="Dell'

<$list filter="[is[current]tagging[]tag[$:/Note]!vendor[Dell]sort[stoimost]]"/>  if I check (uncheck) "Nikon" the list must look like <$list filter="[is[current]tagging[]tag[$:/Note]!vendor[Dell]!vendor[Nikon]sort[stoimost]]"/>

so I want to create filter modifying by the lists of checkboxes .

but I can't understand, how to put many $fieldname$ into my list.



пятница, 17 апреля 2015 г., 0:15:14 UTC+3 пользователь Jeremy Ruston написал:
This was a fun little problem to solve. The solution I've come up with isn't pretty, but it seems to work:

\define inner(fieldName)
<$set name="v" value={{!!$fieldName$}}>
<$list filter="[<v>regexp[^yes$]]" variable="x">
<$text text="""$fieldName$"""/>
</$list>
</$set>
\end

<$list filter="[<currentTiddler>fields[]sort[]]" variable="fieldName">
<$macrocall $name="inner" fieldName=<<fieldName>>/>
</$list>

The regexp is particularly egregious; it's needed because we don't have a straightforward way to test a title for equality.

Best wishes

Jeremy.



--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/3caa627a-d70f-49cc-9464-176004ef6d2e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Stephan Hradek

unread,
Apr 20, 2015, 9:27:11 AM4/20/15
to tiddl...@googlegroups.com, jeremy...@gmail.com
It's very difficult (for me) to follow what you're trying to achive. Do you have someting online where we can take a look anf maybe experiment?

sini-Kit

unread,
Apr 20, 2015, 12:26:44 PM4/20/15
to tiddl...@googlegroups.com, jeremy...@gmail.com
you can see my experiments here http://novye-podarki.ru/heeg203_vk2.html 
I try to make a simple selection by vendor in my tiddlywiki Shop http://novye-podarki.ru/
But I this variant it is not possible to add sort  or to add another field to include (country for example) 

понедельник, 20 апреля 2015 г., 16:27:11 UTC+3 пользователь Stephan Hradek написал:

Jeremy Ruston

unread,
Apr 16, 2015, 5:15:14 PM4/16/15
to TiddlyWiki
This was a fun little problem to solve. The solution I've come up with isn't pretty, but it seems to work:

\define inner(fieldName)
<$set name="v" value={{!!$fieldName$}}>
<$list filter="[<v>regexp[^yes$]]" variable="x">
<$text text="""$fieldName$"""/>
</$list>
</$set>
\end

<$list filter="[<currentTiddler>fields[]sort[]]" variable="fieldName">
<$macrocall $name="inner" fieldName=<<fieldName>>/>
</$list>

The regexp is particularly egregious; it's needed because we don't have a straightforward way to test a title for equality.

Best wishes

Jeremy.


On Thu, Apr 16, 2015 at 6:16 PM, Jed Carty <inmy...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
Reply all
Reply to author
Forward
0 new messages