Added to TW-Scripts!

On Tuesday, April 7, 2020 at 12:15:10 AM UTC+4:30, Saq Imtiaz wrote:
>
> This is my understanding of how the each filter is used:
>
> I think of each as "group by operand". So for each value of context it 
> reduces the list to one tiddler with that value, from which you can then 
> get the value of context. 
>
> If you reduce to a single field with get first, you can't group as all you 
> have now is a list of contexts. You could then probably do something like 
> this:
> [tag[Task]get[context]unique[]]
>
> On Monday, April 6, 2020 at 7:23:30 PM UTC+2, Mark S. wrote:
>>
>> This finds your unique contexts, puts them in the variable "item", and 
>> lists them:
>>
>> <$list filter="[tag[Task]each[context]get[context]]" variable="item">
>>  <<item>> <br/>
>> </$list>
>>
>> The "each" operator removes duplicates. The "get" operator gets the 
>> value. I've never really understood why "each" comes before "get", but that 
>> is the recipe you find at tiddlywiki.com.
>>
>> HTH
>>
>> On Monday, April 6, 2020 at 8:37:48 AM UTC-7, David wrote:
>>>
>>> I have a bunch of tiddlers with the tag of "Task" and a field called 
>>> "context" 
>>>
>>> I'd like to loop over them, or whatever, and end up with a variable or 
>>> tiddler that is a list of all the different values found in that "context" 
>>> field.
>>>
>>> I then plan to loop over that and show some stuff.  Right now, that list 
>>> is static and manually created by me.
>>>
>>> I don't know if there is a command to do it efficiently, or if a loop is 
>>> necessary.
>>>
>>> For example... if tiddlers look like...
>>>
>>> Name/Title    | Context (Field)
>>> --------------|--------------------------------------
>>> Clean Gutters | Home
>>> Wash Car      | Home
>>> Call School   | Work
>>> Buy bolts     | Out
>>>
>>>
>>> Then it should save "Home Work Out" into a variable or tiddler.  I guess 
>>> variable would be best, if possible.
>>>
>>> Here is some code to loop over the tag in question, and this transclude 
>>> command outputs the context, but of course, there are repeats (which I 
>>> don't want).  And of course, this doesn't save it to a variable.  But maybe 
>>> it's a good start?
>>>
>>> <$list filter="[tag[Task]]" variable="item">
>>>  <$transclude tiddler=<<item>> field="context" />
>>> </$list>
>>>
>>>
>>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ce90fabd-6205-4699-aec4-8696d093792a%40googlegroups.com.

Reply via email to