Hio,
Back in my code
<ul>
<$list filter="[all[]prefix[New]has[field]]">
<li><span style={{{
[all[]prefix[New]!title<currentTiddler>get[field]match{!!field}then[color:
red;]] }}}>* <<currentTiddler>> {{!!field}}*</span></li>
</$list>
</ul>
*<<currentTiddler>> {{!!field}} *is the display
replace this with
*{{{ [all[current]get[field]format:date[]] }}}*
Not tested by me on this occasion
where field is the chosen fieldname.
Regards
Tones
On Monday, 16 August 2021 at 12:14:51 UTC+10 [email protected] wrote:
> Thank you tones
>
> The real life example is to evaluate duplicate dates, so the actual real
> values populating the fields are not 1 ,2 , etc.. they are actual dates ,
> IE . 20210625062959999, 20210811055859000,etc.
> and so what i was trying is to do is have the highlighted duplicate
> values converted from the tiddly wiki format they are stored in in their
> respective fields , to a normal readable format when displayed in the filter
>
> the
> On Monday, August 16, 2021 at 2:34:07 AM UTC+2 TW Tones wrote:
>
>> Mohammad,
>>
>> I am confused, until now the fields field_example, field_example1,
>> field_example2 did not contain dates.
>>
>> - Are you trying to convert these to dates?
>> - the view widget format=date only works on tiddlywiki full serial
>> number dates!
>>
>> Perhaps step back and describe what you want to do in the real world, not
>> with tiddlywiki code that may or may not be correct.
>>
>> Regards
>> Tones
>>
>> On Monday, 16 August 2021 at 01:46:55 UTC+10 [email protected]
>> wrote:
>>
>>> HI tones,
>>>
>>> sorry i guess i asked the wrong question, what i wanted to know is where
>>> to place the widget in the code , if i do it that way , it no longer
>>> highlights duplicates
>>>
>>> <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-->
>>> <$view field="field_example "format=date template="YYYY"/>
>>> <$view field="field_example1"format=date template="YYYY"/>
>>> <$view field="field_example2"format=date template="YYYY"/>
>>>
>>> <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>
>>>
>>> i also tried adding format:date[DDD]] , which didn't yield any results
>>>
>>> <$list filter="[all[current]get[field_example]]
>>> [all[current]get[field_example2]] [all[current]get[field_example3]]"
>>> format:date[DDD]] variable=field-value>
>>> On Sunday, August 15, 2021 at 10:12:57 AM UTC+2 TW Tones wrote:
>>>
>>>> Look for and use the viewWidget and use the format date with a
>>>> template, or the format relativedate
>>>>
>>>> Get into the habit also of searching in tiddlywiki.com to learn how to
>>>> do things.
>>>> [image: Snag_c8a06a9.png]
>>>>
>>>> eg;
>>>>
>>>> <$view field=created format=date template="YYYY"/>
>>>>
>>>> <$view field=created format=relativedate/>
>>>>
>>>> 5.1.23 now allows this inside filters.
>>>> <https://tiddlywiki.com/#format%20Operator%20(Examples)>
>>>>
>>>> Regards
>>>> Tones
>>>>
>>>> On Sunday, 15 August 2021 at 10:26:32 UTC+10 [email protected]
>>>> wrote:
>>>>
>>>>> Sorry one more questions
>>>>>
>>>>> if the values are dates, how can they be displayed in normal format
>>>>> ,and not the tiddly wiki format
>>>>>
>>>>> On Monday, August 9, 2021 at 1:10:18 AM UTC+2 paulgilbert2000 wrote:
>>>>>
>>>>>> Thank you tones
>>>>>>
>>>>>> Will take me a while to understand all that . but it works like a
>>>>>> charm , and its even more than what i have asked for
>>>>>>
>>>>>> thanks again:)
>>>>>>
>>>>>> On Sunday, August 8, 2021 at 7:31:10 AM UTC+2 TW Tones wrote:
>>>>>>
>>>>>>> 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/66b507f0-9164-4eb4-9f03-9a7c4e001aa2n%40googlegroups.com.