All,

Just wanted to follow up on this since I appear to have stumbled across the
solution. My problem appears to have been the order in which I placed the
tag filter. I had noted:

"I thought I could fix this by adding "tag[$purchase]" to the first filter
> but doing so caused my list to completely disappear."


I mulled it over and decided to play around with that again. I found that
by placing it at the front of the filter I was able to get the results I
wanted, before I had placed it _*after*_ the aisle tags.

The following code worked for me:

<$list filter="[tag[$purchase]has[aisle]each[aisle]sort[aisle]]">
<div class="tw-menu-list-item">
<$view field="aisle"/>
</div>
<$list filter="[!tag[$purchased]tag[$purchase]aisle{!!aisle}sort[title]]">
<div class="tw-menu-list-subitem">
<$button class="tc-btn-invisible">
<input type="checkbox"/>
<$action-listops $tags="$purchased"/>
</$button> <$link to={{!!title}}><$view field="title"/></$link>
</div></$list></$list>

This dropped the "frozen" category from my list in the example.

Best regards,

mr

On Sun, Jun 13, 2021 at 2:06 PM Boazter <boaz...@gmail.com> wrote:

> I have a question about taking this one step further, but first, I just
> want to say thank you, thank you, thank you for this thread (original
> poster and everyone who helped).
>
> I was able to take this code and incorporate it into a grocery list that
> I'd developed years ago and which I've been wanting to tweak. This code
> allowed me to group my list by the aisle. (In actuality it's more like
> general areas of the store.) It works great and I'm absolutely over the
> moon about it as I had gone down many rabbit holes before I found what I
> was looking for!
>
> Now I'm wondering about tweaking it further so that it doesn't show the
> name of an aisle when there are no items on the list for that particular
> trip.
>
> Let me 'splain:
>
> I have dozens of tiddlers of various grocery items, each with a field
> called "aisle" with values like "bakery", "dairy", "frozen", "meats." I
> have a full list to choose from of potential grocery items and clicking an
> item tags them with "$purchase" (meaning "to be purchased") and they move
> to the current shopping list.
>
> With help from this thread I developed the code below to show the current
> shopping list grouped by aisle. As I shop, checking an item on that list
> tags it as "$purchased" (not to be confused with "$purchase" above!) and
> drops it from the list.
>
> Here is the code:
>
> <$list filter="[has[aisle]each[aisle]sort[aisle]]">
> <div class="tw-menu-list-item">
> <$view field="aisle"/>
> </div>
> <$list filter="[!tag[$purchased]tag[$purchase]aisle{!!aisle}sort[title]]">
> <div class="tw-menu-list-subitem">
> <$button class="tc-btn-invisible">
> <input type="checkbox"/>
> <$action-listops $tags="$purchased"/>
> </$button> <$link to={{!!title}}><$view field="title"/></$link>
> </div></$list></$list>
>
> The above might produce a list something like this:
>
> bakery
>   bread
>   cookies
> dairy
>   milk
>   cream
> frozen
> meats
>   chicken
>   sausage
> etc.
>
> As you can see, there are items under the "aisle" headers for "bakery",
> "dairy" and "meats"; but none under "frozen". What I want is, if there are
> no items from the frozen aisle (aisle="frozen") tagged with "$purchase",
> then suppress the header (in this case "frozen") from appearing on the
> list. That is, only show the header for "aisles" that contain items tagged
> with "$purchase".
>
> I thought I could fix this by adding "tag[$purchase]" to the first filter
> but doing so caused my list to completely disappear.
>
> My skill level is pretty basic but improving. Is there an easy fix for
> this? Am I missing something obvious?
>
> Best regards and thank you for any help.
>
> mr
>
> On Tuesday, March 4, 2014 at 1:03:14 PM UTC-8 Scott Kingery wrote:
>
>> Well, I'm almost there.
>>
>> Example wiki:
>> http://dl.dropboxusercontent.com/u/118970/wiki/scottexamples.html
>> When you look at the example you'll see the issue. It is mostly working
>> but things aren't showing up as they should. I've outlined it in the
>> Problems tiddler you'll see when you look at the example.
>>
>> My code:
>> <$list
>> filter="[is[current]tagging[]has[subtopic]each[subtopic]sort[subtopic]]">
>> <div class="tw-menu-list-item">
>> <$view field="subtopic"/>
>> </div>
>> <$list filter="[subtopic{!!subtopic}sort[title]]">
>> <div class="tw-menu-list-subitem">
>> <$link to={{!!title}}><$view field="title"/> </$link>
>> </div></$list></$list>
>>
>>
>>
>>
>> On Sunday, March 2, 2014 11:08:12 PM UTC-8, Scott Kingery wrote:
>>>
>>> Thanks everyone.
>>> cmari, the each[subtopic] was the piece I was missing I think.
>>>
>>> Additionally, I'm trying to do what you want as well by having the
>>> list search for tiddlers tagged with the current tiddler's title. I
>>> borrowed this:
>>> <$list filter="[is[current]tagging[]sort[title]]">
>>>
>>> from http://www.giffmex.org/tw5mall.htm. It gets us a bit closer by I
>>> can't seem to get the syntax right to merge it in with what you gave me
>>> before.
>>>
>>>
>>> On Sunday, March 2, 2014 1:38:30 PM UTC-8, cmari wrote:
>>>>
>>>> Hi Scott,
>>>>
>>>> I was fiddling around with something similar yesterday.  In case it's
>>>> of interest, here's the (far more rudimentary approach than Stephan's)
>>>> approach I came up with.  Note that this doesn't make use of tags at all,
>>>> it simply finds all the tiddlers that contain a field called subtopic, and
>>>> then lists those tiddlers (alphabetically) by subtopic. You could of course
>>>> sort the lists differently, and you could filter for a particular tag by
>>>> adding, e.g., [tag[Movie], to the second list filter. I would have liked to
>>>> be able to search for tiddlers tagged with the current tiddler's title, or
>>>> even tag, but I don't know how to do that in any generic way, so I opted
>>>> instead to use a unique field name in the tiddlers I wanted in my list.
>>>>
>>>> (Also, obviously, you could take out the styles; I was just seeing what
>>>> I could do with the options that already existed).
>>>>
>>>> <$list
>>>> filter="[!is[system]has[subtopic]each[subtopic]sort[subtopic]]"><div
>>>> class="tw-menu-list-item"><$link to={{!!subtopic}}><$view
>>>> tiddler={{!!subtopic}} field="title"/></$link>
>>>> </div>
>>>> <$list filter="[subtopic{!!subtopic}sort[title]]">
>>>> <div class="tw-menu-list-subitem">
>>>> <$link to={{!!title}}><$view field="title"/> </$link>
>>>> </div></$list></$list>
>>>>
>>>> cmari
>>>>
>>>> On Sunday, March 2, 2014 12:45:26 AM UTC-8, Scott Kingery wrote:
>>>>>
>>>>> I'm just getting started experimenting with TW5. What I want to do is
>>>>> have a field called subtopic and then have those grouped on a list.
>>>>>
>>>>> The results looking something like:
>>>>> Movies (main topic and title of tiddler)
>>>>> Comedy (subtopic)
>>>>> Drama (subtopic)
>>>>>
>>>>> The following is the general idea but doesn't have the syntax to group.
>>>>>
>>>>> <$list filter="[has[subtopic]sort[subtopic]]">
>>>>> <h2><$view field="subtopic"/></h2><$link to={{!!title}}><$view
>>>>> field="title"/></$link><br>
>>>>> </$list>
>>>>>
>>>>> Can this be done?
>>>>> Thanks,
>>>>> Scott
>>>>>
>>>>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "TiddlyWiki" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/tiddlywiki/XxLT8zJqHYM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> tiddlywiki+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/bf28d22d-61da-459e-88de-238faa5463f4n%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/bf28d22d-61da-459e-88de-238faa5463f4n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAK67uv7BMzSCBek5tLqUEs8%2BVsPE6JQmgBntqXfV8fhRXVzGwg%40mail.gmail.com.

Reply via email to