Manipulating lists with select multiple

60 views
Skip to first unread message

TonyM

unread,
Jul 3, 2019, 7:10:18 PM7/3/19
to TiddlyWiki
Folks,

I am building a generic method to select multiple items (in this case people) from one large list, and add/or remove them from a list field. 
I am not sure however to build the button that moves members between lists. Any pointers would be helpful.

It should be simple, but at this time my head is hurting.


I have attached and image to show what I mean.
  • The people in the first column are from the available people (excluding those already in the field office-consultants-list ,
    selecting them stores them in a field temp-select-users
  • The people in the second column are those selected in the First column in field temp-select-users
  • The people in the third column are those already selected in the field office-consultants-list
    and if selected are stored in the field temp-remove-users
I need help creating buttons to
  • Append the people in temp-select-users to the office-consultants-list field
  • Remove the people in temp-remove-users from the office-consultants-list field
Of course I want to add and remove from the current office-consultants-list field, not replace it.

I should be able to return a usable macro

Thanks in advance
Tony
2019-07-04_8-53-38.jpg

Mat

unread,
Jul 3, 2019, 8:31:13 PM7/3/19
to TiddlyWiki
It's a bit too late for me to read you post very carefully but if I understand you right you need help with the moving of items from one list to another. Maybe this helps:

In a tiddler, have a field like so

a : one two three

and in editor preview mode do

<$button>
<$action-listops $field=a $filter="[enlist{!!a}] -two"/>
<$action-listops $field="b" $subfilter="two"/>
>>
</$button>


<:-)

TonyM

unread,
Jul 3, 2019, 9:00:47 PM7/3/19
to TiddlyWiki
Mat,

The problem is I want to
  1. add from a tiddler containing the list to a field
  2. remove from a tiddler containing the list from a field
Eg;
  1. $:/temp/select/add
  2. $:/temp/select/remove
  3. list-field
By late I assume you mean time of day, it being different here and all.

Regards
Tony

Mark S.

unread,
Jul 3, 2019, 9:37:36 PM7/3/19
to TiddlyWiki
Something like Mat had, but since you have an actual list field, and not a text field, perhaps:

<$button>Move right
<$action-listops $field="office-consultants-list" $subfilter="[list[!!temp-select-users]]" />
<$action-listops $field="temp-select-users" $filter="[[]]"/>
</$button>

<$button>Move left
<$action-listops $field="temp-select-users" $subfilter="[list[!!office-consultants-list]]" />
<$action-listops $field="office-consultants-list" $filter="[[]]"/>
</$button>

TonyM

unread,
Jul 3, 2019, 10:32:41 PM7/3/19
to TiddlyWiki
Mark/Mat,

Do I take it then that

$subfilter="[list[!!temp-select-users]]" adds temp-select-users to the list
$subfilter="-[list[!!temp-select-users]]" removes temp-select-users to the list

All the examples give literals with a title, +title -title

This use of the filter format in subfilter confuses me, because filter="-[list[!!temp-select-users]]" would result in nothing in a normal filter.

Regards
Tony

Mark S.

unread,
Jul 3, 2019, 11:32:47 PM7/3/19
to TiddlyWiki
Yes, the subfilter works differently than a plain filter, because the filter is being applied as though the original title list preceded it.

TonyM

unread,
Jul 4, 2019, 3:01:57 AM7/4/19
to TiddlyWiki
Mark.

So is it true to say in the subfilter if you place the - in front of a title OR filter that it is those titles it will remove if tgey exist from the list?

Thanks for your help
Regards
Tony

Mark S.

unread,
Jul 4, 2019, 9:24:03 AM7/4/19
to TiddlyWiki
That's how I understand it, but I don't claim to be an expert.

Good luck!
Reply all
Reply to author
Forward
0 new messages