Mohamad,

I am happy to look at solving the problem presented but my suspicion 
remains that there may be a different way to put the question in the first 
place. 

Sometimes a question can be rephrased such that the answer is simpler to 
find.

   - In this we have multiple tiddlers, with multiple fields, with *values* 
   that may be duplicated across these tiddlers/fields.
   - in effect you want to list all tiddlers using the select fields, list 
   these for each tiddler then for each found value
      -  detect when that value occurs in any other tiddler (not self?) or 
      select fields, if it does highlight it.
   - I am not sure why you want to do this and can think of many ways to 
   list/interpret the data! 
   - What about triplicates?
   - What about duplicates in the same tiddler?

I think using your test data this is what you wanted?

<ul>
<$list filter="[all[]has[field_example]]"><!-- each tiddler meeting 
condition -->
   <$set name=other-values 
filter="[all[]!<currentTiddler>get[field_example]] 
[all[]!title<currentTiddler>get[field_example2]] 
[all[]!title<currentTiddler>get[field_example3]] +[sort[]]"><!-- for this 
tiddler build a list of all values in the three fields except this tiddlers 
-->
   <li><<currentTiddler>>: |  
   <$list filter="[all[current]get[field_example]] 
[all[current]get[field_example2]] [all[current]get[field_example3]]" 
variable=field-value><!-- for each example field get the value on the 
current tiddler-->
        <span style={{{ [enlist<other-values>match<field-value>then[color: 
red;]] }}}><<field-value>></span><!-- change the style to color red if any 
other-values match the current value -->
    </$list></li>
   </$set>
</$list>
</ul>

It will also highlight triplicates...

A slightly more efficient method is available that could actually could the 
number of repeats and color red if > 1

<$set name=all-values filter="=[all[]get[field_example]] 
=[all[]get[field_example2]] =[all[]get[field_example3]]"><!-- get all 
values in all three fields using = so duplicates are not removed -->
"<<all-values>>" {{{ [<all-values>split[ ]count[]] }}}
<ul>
<$list filter="[all[]has[field_example]]"><!-- each tiddler meeting given 
condition -->
   <li><<currentTiddler>>: |  
   <$list filter="[all[current]get[field_example]] 
[all[current]get[field_example2]] [all[current]get[field_example3]]" 
variable=field-value><!-- for each example field get the value on the 
current tiddler-->
        <$set name=value-count filter="[<all-values>split[ 
]match<field-value>count[]]">
        <span style={{{ [<value-count>compare:number:gt[1]then[color: 
Red;]] }}} ><<field-value>> (<<value-count>>)</span><!-- change the style 
to color red if any other-values match the current value -->
         </$set>
    </$list></li>
</$list>
</ul>
</$set>

Of course in the above you can choose not to show the count of the same 
value delete  "(<<value-count>>)"

Regards
Tones

On Sunday, 8 August 2021 at 02:05:57 UTC+10 [email protected] wrote:

> Hi Tones,
>
> sorry for the late reply , i wasn't clear at all in my last question 
> actually
>
> So for example ,if  every tiddler has three fields  , field_example , 
> field_example2 and  field_example3 
>
> [image: Capture.PNG]
>
> and they are populated with values as such
>
>     *   tiddler 1*    has in field_example "3" And in field_example2 "2"    
> And in field_example3 "6"    
> and
>        *tiddler 2 *   has in field_example "4" And in field_example2 "9"    
> And in field_example3 "8"    
> and
>        *tiddler 3    *has in field_example "2" And in field_example2 "7" 
>    And in field_example3 "5"    
> and
>        *tiddler 4    *has in field_example "1" And in field_example2 "2"  
>   And in field_example3 "4"   
>
>
>  as you can see, the number 2  is reoccurring in different fields in 
> different tiddlers , so when doing a list, can all these tiddlers  which 
> has a 2 be highlighted
>
> [image: Capture2.PNG]
>
> even better can the transcluded values only be highlighted and not the 
> whole line
> [image: Capture3.PNG] 
>
> i have attached a sample file with with the test data i am working with
>  
>
> Thanks again for your help
>
>
> On Monday, August 2, 2021 at 2:33:26 AM UTC+2 TW Tones wrote:
>
>> Mohamad,
>>
>> My solution above can be used to do this for multiple fields/criteria 
>> because it re-examines the whole list every time. This makes it logically 
>> very flexible but revisiting the whole list for every special field for 
>> each tiddler is not very high performance. There are other "algorithms you 
>> can deploy" if you describe the full problem, especially if you can share 
>> test data.
>>
>> The thing is, what you want to achieve could be addressed more 
>> efficiently with better knowledge of the input data(set), and ensuring that 
>> data is arranged appropriately. Over in the aforementioned  github item 
>> https://github.com/Jermolene/TiddlyWiki5/discussions/5925 I think a 
>> solution may be a *report widget* designed for most reporting 
>> requirements ie beyond the list widget features. However even in this case 
>> you will need to give further thought on your input data and its structure.
>>
>> Mohamad - you could generate a list of tiddlers with duplicate *A* 
>> fields and another with a list of duplicate *B* fields then in the list 
>> test if each title exists in these lists.
>>
>> Regards
>> Tones
>> On Monday, 2 August 2021 at 09:23:23 UTC+10 [email protected] wrote:
>>
>>> Hi,
>>>
>>> is it possible to use the same code for multiple criteria, so highlight 
>>> in red all occurrences of duplicates in field A and also field B within the 
>>> same list of tiddlers?
>>>
>>> i guess my question is can a Get / then  be used within the same filter 
>>> multiple times for multiple fields/criteria
>>>
>>> thanks
>>>
>>> On Sunday, August 1, 2021 at 6:17:44 PM UTC+2 PMario wrote:
>>>
>>>> Hi, 
>>>>
>>>> Since Tony did present a workable solution, the issue was moved to the 
>>>> discussions section at github. 
>>>> https://github.com/Jermolene/TiddlyWiki5/discussions/5925
>>>>
>>>> I still think, that a <<duplicates>> macro may reduce the complexity of 
>>>> the solution. 
>>>>
>>>> -mario
>>>>
>>>

-- 
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/8d626deb-a71f-4075-9db5-bf96f29699cbn%40googlegroups.com.

Reply via email to