[tw5] Re: Highlighting duplicates in lists

Sorry one more questions

if the values are dates, how can they be displayed in normal format ,and not the tiddly wiki format

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.
Snag_c8a06a9.png

eg;

<$view field=created format=date template=“YYYY”/>

<$view field=created format=relativedate/>

5.1.23 now allows this inside filters.

Regards

Tones

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

  • <>: | <$list filter="[all[current]get[field_example]] [all[current]get[field_example2]] [all[current]get[field_example3]]" variable=field-value>

    <$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={{{ [enlistmatchthen[color: red;]] }}}><>

    </$list>

  • 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>

    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

    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

    Hio,

    Back in my code

      <$list filter="[all[]prefix[New]has[field]]">

    • <span style={{{ [all[]prefix[New]!titleget[field]match{!!field}then[color: red;]] }}}> **<> {{!!field}}**

    <> {{!!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

    Hi Tones,

    I am not sure which line of code you are referring too , the line that does the coloring is

    <$list filter="[all[current]get[field_example]] [all[current]get[field_example2]] [all[current]get[field_example3]]" variable=field-value>
    <span style={{{ [enlistmatchthen[color: red;]] }}}><>

    It does not have <> {{!!field}}

    instead there is <> ,so is this the bit that should be replaced ?

    i tried this with no luck…

    1 Like

    Hi tones,

    have you had the chance to look at my last post?

    The information you are after is in my earlier post

    <> {{!!field}} is the display replace this with {{{ [all[current]get[field]format:date[]] }}}

    It is what is inside the span that gets coloured using style attribute, thus what is inside the span is what is displayed,

  • <span style={{{ [all[]prefix[New]!titleget[field]match{!!field}then[color: red;]] }}}> **this is displayed inside the list**
  • So basically we replace the display of {{!!field}}
    With {{{ [all[current]get[field]format:date[]] }}}
    (change “field” to your date field)

    So the following will be inside the span because you want the title and its date.
    <> {{{ [all[current]get[field]format:date[]] }}}

    The format operator requires tiddlywiki 5.1.23 or greater

    Tones

    thanks tones,

    back one step , the original code was …

    <span style={{{ [enlistmatchthen[color: red;]] }}}><>
    </$list>
    </$set>
    </$list>

    the modified code is as follows
  • <span style={{{ [all[]prefix[New]!titleget[field]match**{!!field}**then[color: red;]] }}}> **this is displayed inside the list**
  • the instruction is to replace
    {{!!field}}
    With {{{ [all[current]get[field]format:date[]] }}}
    (change “field” to your date field)

    making the code

  • <span style={{{ [all[]prefix[New]!titleget[field]match **{{{ [all[current]get[field_example]format:date[]] }}}** then[color: red;]] }}}> this is displayed inside the list
  • this does not work, prob because i have misinterpreted your instructions

    also there are several things missed out in the modified code , the enlist operator, the variable, is this intentional?

    if the date field is “field_example” , can you please tell me what the full line of code would be … <Span to

    thanks again

    Mohamad,

    Part of the issue here is you have not yet learned the basic syntax of tiddlywiki yet, we all start somewhere, my instructions should have being self evident if you had just rudimentary tiddlywiki syntax, all of which I learned from TiddlyWiki.com

    I did answer this latest question here and you can put {{{ [all[current]get[date-field]format:date[]] }}} where you read this is displayed inside the list

    I am happy still to help, but you force me to revisit the whole thread again. I am not sure that when I gave previous answers, you tried to understand what I shared with you, it seems more like you just tried to “plugin my answers” to your code without trying to work it out. I may be wrong but please try a little harder to work through the carefully considered answers you get.

    Tones

    Thanks tones

    actually my problem is not lack of effort but rather lack of knowledge :frowning: , i try many different things before coming back, its just like you said i am guilty of trying to plug in the code rather than fully understanding it

    well then …i guess its time for me to up my game with the filter syntax first before attempting anything else

    i guess for now the thread can be closed, but thanks again for you help :slight_smile:

    1 Like

    Mohamad,

    Sorry, I did not mean to imply you were not putting in the effort, more that you needed to direct it elsewhere first.

    Although it is great to see you are keen and jumping into it, it can just make it a little hard to support you. Don’t be shy to keep asking, but trust in your ability to learn yourself as well.

    Tones