List values and add/remove from field

138 views
Skip to first unread message

vinvi...@gmail.com

unread,
Jun 4, 2021, 5:41:16 AM6/4/21
to TiddlyWiki
Hello,

To avoid duplications of values in fields warning;
list all unique values from the warning field of all tiddlers with 2 buttons: Add and Remove. (Add and remove from $(currentTiddler)$ )


<$list filter="[tags:warning[]]" variable=warning-value>

<$button type="button" class="btn btn-secondary btn-mini" >
<$action-listops $field="warning" $subfilter=<<warning-value>>/>
{{$:/core/images/new-button}}
</$button>
<$button type="button" class="btn btn-secondary btn-mini" >
<$action-listops $field="warning" $subfilter=<<warning-value>>/>
{{$:/core/images/delete-button}}
</$button>
<<warning-value>>
</$list>


1) When the value is added to the field, the square brackets are missing. How do I ensure that the value is noted between square brackets?

2) I am unable to remove the value from the field. 
$subfilter="-123" is working. But how do I get it to work referring to <<warning-value>>?

3) It would be totally awesome if I had a search function. By replacing <$list filter with;

<<list-search filter:"[tags:warning[]]" placeholder: "Search field warning">>

Which works fine on its own but I can't get it implemented.


Can somebody please help me out?

Mohammad Rahmani

unread,
Jun 4, 2021, 7:08:33 AM6/4/21
to tiddl...@googlegroups.com
The below modified code answers your questions 1 and 2.

<$list filter="[tags:warning[]]" variable=warning-value>

<$button type="button" class="btn btn-warning btn-mini" >

<$action-listops $field="warning" $subfilter="[<warning-value>]" />
{{$:/core/images/new-button}}
</$button>
<$button type="button" class="btn btn-info btn-mini" >
<$action-listops $field="warning" $subfilter="-[<warning-value>]" />

{{$:/core/images/delete-button}}
</$button>
<<warning-value>>
</$list>


I did not understand what you wanted by Q3! Where do you want to search? in the warning field?


Best wishes
Mohammad


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/19c9a8cf-efbf-4a6e-bb51-76d6e96c5a14n%40googlegroups.com.

Mohammad Rahmani

unread,
Jun 4, 2021, 7:13:07 AM6/4/21
to tiddl...@googlegroups.com
Also what do you mean by this:

<$list filter="[tags:warning[]]" variable=warning-value>


do you mean

<$list filter="[tags[]]" variable=warning-value>

I have not seen tags that can accept modifiers!


Best wishes
Mohammad


On Fri, Jun 4, 2021 at 2:11 PM vinvi...@gmail.com <vinvi...@gmail.com> wrote:
--

Mohammad Rahmani

unread,
Jun 4, 2021, 7:29:28 AM6/4/21
to tiddl...@googlegroups.com
This second code also search in field warning using Shiraz list-search

<$vars items={{{[<currentTiddler>get[warning]] }}} >
<<list-search filter:"[enlist<items>]" search:"search:title">>
</$vars>

<$count filter="[tags[]!is[system]]" />

<$list filter="[tags[]!is[system]]" variable=warning-value>

<$button type="button" class="btn btn-warning btn-mini" >

<$action-listops $field="warning" $subfilter="[<warning-value>]" />
{{$:/core/images/new-button}}
</$button>
<$button type="button" class="btn btn-info btn-mini" >
<$action-listops $field="warning" $subfilter="-[<warning-value>]" />
{{$:/core/images/delete-button}}
</$button>
<$text text=<<warning-value>>/>
</$list>

I modified your filter, as I think yours is not correct!


Best wishes
Mohammad


On Fri, Jun 4, 2021 at 2:11 PM vinvi...@gmail.com <vinvi...@gmail.com> wrote:
--

vinvi...@gmail.com

unread,
Jun 4, 2021, 8:05:41 AM6/4/21
to TiddlyWiki
Thanks Mohammad, 
what you have done is working. Thank you so much!

Only it does not display the values from the "warning" fields.

By replacing this code:
<$list filter="[tags[]!is[system]]" variable=warning-value>
with this:
<$list filter="[tags:warning[]]" variable=warning-value>

I at least get it working.


What I mean by: [tags:warning[]]?
I honestly have no idea. I've been working on this piece of code for a while and couldn't figure it out. Somehow that got in there and it works.

Maybe you have another suggestion?

Thank you,

Op vrijdag 4 juni 2021 om 13:29:28 UTC+2 schreef Mohammad:

Mohammad Rahmani

unread,
Jun 4, 2021, 9:05:00 AM6/4/21
to tiddl...@googlegroups.com
<$list filter="[tags[]!is[system]]" variable=warning-value>

means list all Non system tags!

  <$list filter="[tags[]]" variable=warning-value>

  means list all  tags including systems tags!
<$vars items={{{[<currentTiddler>get[warning]] }}} >
<<list-search filter:"[enlist<items>]" search:"search:title">>
</$vars>

create a list search lets you to search in the warning field of current tiddler

Best wishes
Mohammad


vinvi...@gmail.com

unread,
Jun 4, 2021, 10:50:03 AM6/4/21
to TiddlyWiki

It has nothing to do with tags, just search in "all fields warning" and add or remove the value in field warning of the current tiddler.


Op vrijdag 4 juni 2021 om 15:05:00 UTC+2 schreef Mohammad:

Mohammad Rahmani

unread,
Jun 4, 2021, 12:03:26 PM6/4/21
to tiddl...@googlegroups.com
It has nothing to do with tags, just search in "all fields warning" and add or remove the value in field warning of the current tiddler.

Then you need to use 

[all[tiddlers]has:field[warning]]


Look at "has operator" on tiddlywiki.com



Best wishes
Mohammad


vinvi...@gmail.com

unread,
Jun 4, 2021, 1:14:44 PM6/4/21
to TiddlyWiki
Hi Mohammad,

That lists the title of the tiddlers that have the field warning. It should list all unique values out of all fields warning.

Op vrijdag 4 juni 2021 om 18:03:26 UTC+2 schreef Mohammad:

Mohammad Rahmani

unread,
Jun 4, 2021, 2:11:55 PM6/4/21
to tiddl...@googlegroups.com
On Fri, Jun 4, 2021 at 9:44 PM vinvi...@gmail.com <vinvi...@gmail.com> wrote:
Hi Mohammad,

That lists the title of the tiddlers that have the field warning. It should list all unique values out of all fields warning.

Right! So it works correctly! Now you need to populate them and display them!
The simplest is using a macro to populate, then wikify and use enlist!

This way: 
First: it finds all tiddlers with the field warning
Next: The macro populate all values in warning field of those tiddlers
Last: A wikify gets the values and an enlist will show them while removing duplicates




 

vinvindtvin

unread,
Jun 5, 2021, 2:24:48 AM6/5/21
to tiddl...@googlegroups.com
Thank you

-------- Oorspronkelijk bericht --------
Van: Mohammad Rahmani <mohammad...@gmail.com>
Datum: 04-06-21 20:11 (GMT+01:00)
Onderwerp: Re: [tw5] List values and add/remove from field

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/6kuu-EnPEL8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMBQA%2BSDbj3ZP1WD-imBiXAjon%2BMOUmFkwomomjEHXgHSg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages