[tw5] Re: List Fields : How to get the "Position" of an item in a list field

2021-04-04 Thread Adithya B
A related question:

Is there any existing solution to take user input and put a list of 
tiddlers into a field? Something with dropdown/autocomplete like the 
tag-picker dialog?


On Saturday, April 3, 2021 at 11:38:09 PM UTC-6 TW Tones wrote:

> Mohammadd,
>
> I just saw this now. The Count operator or count widget, with an allbefore 
> can be used to count the items before a position in a list to get the N for 
> the Nth.
>
> [{!!list}allbefore[string]count[]] or something similar. add[1] if needed.
>
> Tones
>
>
> On Tuesday, 23 March 2021 at 22:16:08 UTC+11 Mohamed Amin wrote:
>
>> Thanks @Mat this is a clever workaround solution.
>>
>> @Tones, thanks for your reply, but I couldn't get your idea, how can I 
>> use "range operator" to calculate the number "N" that I'll use in the 
>> "nth[N]" operator?
>>
>>
>> On Tuesday, March 23, 2021 at 12:34:00 PM UTC+2 TW Tones wrote:
>>
>>> Mats suggestion is one I use.
>>>
>>> Another trick is to use count to get the total number T of items then 
>>> use a range operator from 1 to N, in which the current tiddler will be the 
>>> item number.
>>>
>>> However you then need to retrieve the nth[N] item from the list.
>>>
>>> Regards
>>> Tones
>>>
>>> On Tuesday, 23 March 2021 at 21:24:41 UTC+11 Mat wrote:
>>>
 You can use this to find the position of an item in a list

 +[allbeforecount[]add[1]]

 e.g 

 {{{ one two three four five +[allbefore[four]count[]add[1]]  }}} > 4

 Not sure it's the optimal solution, I just made it up.

 <:-)
  


 On Tuesday, March 23, 2021 at 10:57:48 AM UTC+1 Mohamed Amin wrote:

> Hi,
>
> Is there a way to get the position of an item in a "list field"?
>
> More info:
> Recently I've discovered the "nth" filter operator 
> , and one of the use case I 
> immediately think about was to "iterate" through items in multiple 
> related 
> "list fields"
>
> Take the following example (not a real one, just to get the idea 
> clear):
> If a family needs to manage its friends, each family member's Tiddler 
> will have the following fields:
> 1- friend-names : "list field" contains ALL friends
> 2- friendships-start-date : "list field" where the "position" of the 
> date determine the friend's names
> 3- friendships-meter : "list field" where the "position" of the % 
> determine the friend's names
>
> Ex.
> friend-names : [[alex]]  [[andy]]
> [[john]] [[evan]]
> friendships-start-date :  [[Mar2015]]   [[Dec2017]][[Nov2016]]
>  [[Feb2011]]
> friendships-meter [[70]]  [[30]]  
>  [[60]][[90]]
>
> Now I can use the filter "[contain:friend-name[alex]]" to get all 
> family members who is a friend with "alex".
> And if I know the <> of "alex" in the "friend-names" field, 
> I can get the rest of the data corresponding to it for the currentTiddler 
> using a filter like:
> "[all[current]get[friendships-meter]enlist-input[]nth]" 
>
> Regards
>
>

-- 
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/7ec09788-4b96-4167-8c39-ee47b4650d41n%40googlegroups.com.


[tw5] Re: List Fields : How to get the "Position" of an item in a list field

2021-04-03 Thread TW Tones
Mohammadd,

I just saw this now. The Count operator or count widget, with an allbefore 
can be used to count the items before a position in a list to get the N for 
the Nth.

[{!!list}allbefore[string]count[]] or something similar. add[1] if needed.

Tones


On Tuesday, 23 March 2021 at 22:16:08 UTC+11 Mohamed Amin wrote:

> Thanks @Mat this is a clever workaround solution.
>
> @Tones, thanks for your reply, but I couldn't get your idea, how can I use 
> "range operator" to calculate the number "N" that I'll use in the "nth[N]" 
> operator?
>
>
> On Tuesday, March 23, 2021 at 12:34:00 PM UTC+2 TW Tones wrote:
>
>> Mats suggestion is one I use.
>>
>> Another trick is to use count to get the total number T of items then use 
>> a range operator from 1 to N, in which the current tiddler will be the item 
>> number.
>>
>> However you then need to retrieve the nth[N] item from the list.
>>
>> Regards
>> Tones
>>
>> On Tuesday, 23 March 2021 at 21:24:41 UTC+11 Mat wrote:
>>
>>> You can use this to find the position of an item in a list
>>>
>>> +[allbeforecount[]add[1]]
>>>
>>> e.g 
>>>
>>> {{{ one two three four five +[allbefore[four]count[]add[1]]  }}} > 4
>>>
>>> Not sure it's the optimal solution, I just made it up.
>>>
>>> <:-)
>>>  
>>>
>>>
>>> On Tuesday, March 23, 2021 at 10:57:48 AM UTC+1 Mohamed Amin wrote:
>>>
 Hi,

 Is there a way to get the position of an item in a "list field"?

 More info:
 Recently I've discovered the "nth" filter operator 
 , and one of the use case I 
 immediately think about was to "iterate" through items in multiple related 
 "list fields"

 Take the following example (not a real one, just to get the idea clear):
 If a family needs to manage its friends, each family member's Tiddler 
 will have the following fields:
 1- friend-names : "list field" contains ALL friends
 2- friendships-start-date : "list field" where the "position" of the 
 date determine the friend's names
 3- friendships-meter : "list field" where the "position" of the % 
 determine the friend's names

 Ex.
 friend-names : [[alex]]  [[andy]][[john]]  
[[evan]]
 friendships-start-date :  [[Mar2015]]   [[Dec2017]][[Nov2016]]
  [[Feb2011]]
 friendships-meter [[70]]  [[30]]   [[60]]  
   [[90]]

 Now I can use the filter "[contain:friend-name[alex]]" to get all 
 family members who is a friend with "alex".
 And if I know the <> of "alex" in the "friend-names" field, 
 I can get the rest of the data corresponding to it for the currentTiddler 
 using a filter like:
 "[all[current]get[friendships-meter]enlist-input[]nth]" 

 Regards



-- 
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/025a455d-f8ec-4ee1-b7a1-230b6aeacbb3n%40googlegroups.com.


[tw5] Re: List Fields : How to get the "Position" of an item in a list field

2021-03-23 Thread Mohamed Amin
For future reference: I found the following related:

   1. GitHub issue : Provide an index value in lists #3384 
    (also there're 
   many other related issues)
   2. Macro by tobibeer 


On Tuesday, March 23, 2021 at 1:16:08 PM UTC+2 Mohamed Amin wrote:

> Thanks @Mat this is a clever workaround solution.
>
> @Tones, thanks for your reply, but I couldn't get your idea, how can I use 
> "range operator" to calculate the number "N" that I'll use in the "nth[N]" 
> operator?
>
>
> On Tuesday, March 23, 2021 at 12:34:00 PM UTC+2 TW Tones wrote:
>
>> Mats suggestion is one I use.
>>
>> Another trick is to use count to get the total number T of items then use 
>> a range operator from 1 to N, in which the current tiddler will be the item 
>> number.
>>
>> However you then need to retrieve the nth[N] item from the list.
>>
>> Regards
>> Tones
>>
>> On Tuesday, 23 March 2021 at 21:24:41 UTC+11 Mat wrote:
>>
>>> You can use this to find the position of an item in a list
>>>
>>> +[allbeforecount[]add[1]]
>>>
>>> e.g 
>>>
>>> {{{ one two three four five +[allbefore[four]count[]add[1]]  }}} > 4
>>>
>>> Not sure it's the optimal solution, I just made it up.
>>>
>>> <:-)
>>>  
>>>
>>>
>>> On Tuesday, March 23, 2021 at 10:57:48 AM UTC+1 Mohamed Amin wrote:
>>>
 Hi,

 Is there a way to get the position of an item in a "list field"?

 More info:
 Recently I've discovered the "nth" filter operator 
 , and one of the use case I 
 immediately think about was to "iterate" through items in multiple related 
 "list fields"

 Take the following example (not a real one, just to get the idea clear):
 If a family needs to manage its friends, each family member's Tiddler 
 will have the following fields:
 1- friend-names : "list field" contains ALL friends
 2- friendships-start-date : "list field" where the "position" of the 
 date determine the friend's names
 3- friendships-meter : "list field" where the "position" of the % 
 determine the friend's names

 Ex.
 friend-names : [[alex]]  [[andy]][[john]]  
[[evan]]
 friendships-start-date :  [[Mar2015]]   [[Dec2017]][[Nov2016]]
  [[Feb2011]]
 friendships-meter [[70]]  [[30]]   [[60]]  
   [[90]]

 Now I can use the filter "[contain:friend-name[alex]]" to get all 
 family members who is a friend with "alex".
 And if I know the <> of "alex" in the "friend-names" field, 
 I can get the rest of the data corresponding to it for the currentTiddler 
 using a filter like:
 "[all[current]get[friendships-meter]enlist-input[]nth]" 

 Regards



-- 
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/d1922324-317b-4e39-ade5-1de886490fa9n%40googlegroups.com.


[tw5] Re: List Fields : How to get the "Position" of an item in a list field

2021-03-23 Thread Mohamed Amin
Thanks @Mat this is a clever workaround solution.

@Tones, thanks for your reply, but I couldn't get your idea, how can I use 
"range operator" to calculate the number "N" that I'll use in the "nth[N]" 
operator?


On Tuesday, March 23, 2021 at 12:34:00 PM UTC+2 TW Tones wrote:

> Mats suggestion is one I use.
>
> Another trick is to use count to get the total number T of items then use 
> a range operator from 1 to N, in which the current tiddler will be the item 
> number.
>
> However you then need to retrieve the nth[N] item from the list.
>
> Regards
> Tones
>
> On Tuesday, 23 March 2021 at 21:24:41 UTC+11 Mat wrote:
>
>> You can use this to find the position of an item in a list
>>
>> +[allbeforecount[]add[1]]
>>
>> e.g 
>>
>> {{{ one two three four five +[allbefore[four]count[]add[1]]  }}} > 4
>>
>> Not sure it's the optimal solution, I just made it up.
>>
>> <:-)
>>  
>>
>>
>> On Tuesday, March 23, 2021 at 10:57:48 AM UTC+1 Mohamed Amin wrote:
>>
>>> Hi,
>>>
>>> Is there a way to get the position of an item in a "list field"?
>>>
>>> More info:
>>> Recently I've discovered the "nth" filter operator 
>>> , and one of the use case I 
>>> immediately think about was to "iterate" through items in multiple related 
>>> "list fields"
>>>
>>> Take the following example (not a real one, just to get the idea clear):
>>> If a family needs to manage its friends, each family member's Tiddler 
>>> will have the following fields:
>>> 1- friend-names : "list field" contains ALL friends
>>> 2- friendships-start-date : "list field" where the "position" of the 
>>> date determine the friend's names
>>> 3- friendships-meter : "list field" where the "position" of the % 
>>> determine the friend's names
>>>
>>> Ex.
>>> friend-names : [[alex]]  [[andy]][[john]]  
>>>[[evan]]
>>> friendships-start-date :  [[Mar2015]]   [[Dec2017]][[Nov2016]]
>>>  [[Feb2011]]
>>> friendships-meter [[70]]  [[30]]   [[60]]  
>>>   [[90]]
>>>
>>> Now I can use the filter "[contain:friend-name[alex]]" to get all 
>>> family members who is a friend with "alex".
>>> And if I know the <> of "alex" in the "friend-names" field, I 
>>> can get the rest of the data corresponding to it for the currentTiddler 
>>> using a filter like:
>>> "[all[current]get[friendships-meter]enlist-input[]nth]" 
>>>
>>> Regards
>>>
>>>

-- 
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/a0af5f7c-ca92-4a14-93b9-169a2566b501n%40googlegroups.com.


[tw5] Re: List Fields : How to get the "Position" of an item in a list field

2021-03-23 Thread TW Tones
Mats suggestion is one I use.

Another trick is to use count to get the total number T of items then use a 
range operator from 1 to N, in which the current tiddler will be the item 
number.

However you then need to retrieve the nth[N] item from the list.

Regards
Tones

On Tuesday, 23 March 2021 at 21:24:41 UTC+11 Mat wrote:

> You can use this to find the position of an item in a list
>
> +[allbeforecount[]add[1]]
>
> e.g 
>
> {{{ one two three four five +[allbefore[four]count[]add[1]]  }}} > 4
>
> Not sure it's the optimal solution, I just made it up.
>
> <:-)
>  
>
>
> On Tuesday, March 23, 2021 at 10:57:48 AM UTC+1 Mohamed Amin wrote:
>
>> Hi,
>>
>> Is there a way to get the position of an item in a "list field"?
>>
>> More info:
>> Recently I've discovered the "nth" filter operator 
>> , and one of the use case I 
>> immediately think about was to "iterate" through items in multiple related 
>> "list fields"
>>
>> Take the following example (not a real one, just to get the idea clear):
>> If a family needs to manage its friends, each family member's Tiddler 
>> will have the following fields:
>> 1- friend-names : "list field" contains ALL friends
>> 2- friendships-start-date : "list field" where the "position" of the date 
>> determine the friend's names
>> 3- friendships-meter : "list field" where the "position" of the % 
>> determine the friend's names
>>
>> Ex.
>> friend-names : [[alex]]  [[andy]][[john]]
>>  [[evan]]
>> friendships-start-date :  [[Mar2015]]   [[Dec2017]][[Nov2016]]
>>  [[Feb2011]]
>> friendships-meter [[70]]  [[30]]   [[60]]
>> [[90]]
>>
>> Now I can use the filter "[contain:friend-name[alex]]" to get all family 
>> members who is a friend with "alex".
>> And if I know the <> of "alex" in the "friend-names" field, I 
>> can get the rest of the data corresponding to it for the currentTiddler 
>> using a filter like:
>> "[all[current]get[friendships-meter]enlist-input[]nth]" 
>>
>> Regards
>>
>>

-- 
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/5bdc51a1-1ea9-4175-893a-4eac2f764ad3n%40googlegroups.com.


[tw5] Re: List Fields : How to get the "Position" of an item in a list field

2021-03-23 Thread Mat
You can use this to find the position of an item in a list

+[allbeforecount[]add[1]]

e.g 

{{{ one two three four five +[allbefore[four]count[]add[1]]  }}} > 4

Not sure it's the optimal solution, I just made it up.

<:-)
 


On Tuesday, March 23, 2021 at 10:57:48 AM UTC+1 Mohamed Amin wrote:

> Hi,
>
> Is there a way to get the position of an item in a "list field"?
>
> More info:
> Recently I've discovered the "nth" filter operator 
> , and one of the use case I 
> immediately think about was to "iterate" through items in multiple related 
> "list fields"
>
> Take the following example (not a real one, just to get the idea clear):
> If a family needs to manage its friends, each family member's Tiddler will 
> have the following fields:
> 1- friend-names : "list field" contains ALL friends
> 2- friendships-start-date : "list field" where the "position" of the date 
> determine the friend's names
> 3- friendships-meter : "list field" where the "position" of the % 
> determine the friend's names
>
> Ex.
> friend-names : [[alex]]  [[andy]][[john]]
>  [[evan]]
> friendships-start-date :  [[Mar2015]]   [[Dec2017]][[Nov2016]]
>  [[Feb2011]]
> friendships-meter [[70]]  [[30]]   [[60]]
> [[90]]
>
> Now I can use the filter "[contain:friend-name[alex]]" to get all family 
> members who is a friend with "alex".
> And if I know the <> of "alex" in the "friend-names" field, I 
> can get the rest of the data corresponding to it for the currentTiddler 
> using a filter like:
> "[all[current]get[friendships-meter]enlist-input[]nth]" 
>
> Regards
>
>

-- 
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/ec48008c-ca95-493a-ba2f-a19b64fc4ff2n%40googlegroups.com.