How to find dupes in a list-type field?

61 views
Skip to first unread message

Mark S.

unread,
Jul 26, 2018, 3:23:20 PM7/26/18
to TiddlyWiki
I would like to detect the presence of duplicates in a series like this:

MO10 TU10 WE10 TH10 TU10 TH10

I thought I could do this with list or enlist by subtracting a packed list from a non-packed list. Unfortunately, list and enlist both remove duplicates even before you start.

I'm storing the list-like items in a field "times" because if I attempt to store them in "list" it will automatically pack them!

Suggestions?

Thanks!
-- Mark

TonyM

unread,
Jul 26, 2018, 9:26:09 PM7/26/18
to TiddlyWiki
Mark, for you and others that may pass this way,

As I expect you know this is the behaviour of the filters as well, so you could have a filter

<$list filter={{!!filter-field}}>


</$list>


where filter-field = a a b c  c d a
and it will still remove duplicates
Of course in Wiki Text {{!!filter-field}} continues to return the original

This is of course because of an assumption that we are dealing with tiddler titles which are unique so de-duping them makes sense and is very helpful 98% of the time.

<$list filter="[list[DependantSelect!!filter-field]nth[2]]" variable=result>
<
<result>><br>
</$list>
even this above returns the nth after de-duping.

I have seen mention of an action that does bypass this but do not recall where.

I am investigating, its a challenge worthy of resolution here are some current thoughts
  • Would storing these values in a datatiddler overcome this?
  • Why would string operators not do this (they seem not to) or are they really title operators?
I have come to realise this was possibly a conceptual fact not spelled out sufficiently in the documentation, 
and by not providing a way to bypass it, makes it even more confusing because it seems obvious you should be able to do it.

Regards
Tony

TonyM

unread,
Jul 26, 2018, 9:27:30 PM7/26/18
to TiddlyWiki
Mark,

Do you want to test that there are duplicates without any additional details? like name and number od?

Or do you want to list the duplicate values themself?

Regards
Tony

On Friday, July 27, 2018 at 5:23:20 AM UTC+10, Mark S. wrote:

Mark S.

unread,
Jul 26, 2018, 10:14:59 PM7/26/18
to TiddlyWiki
I just need to test the duplicates. Or at least that was my plan. The idea was to subtract one set of timestamps with no dupes from another in order to determine if there is a schedule conflict. That is, if there are datestamps leftover, then there must be a conflict.

I hadn't realized until today that dupes are automatically removed. It makes me wonder what the point of the "each" operator is.

Thanks,
-- Mark

TonyM

unread,
Jul 26, 2018, 10:33:49 PM7/26/18
to TiddlyWiki
Mark,

Yup, the each operator is for each case on a tiddler title. There is a suffix for that operator but it does not help us.

There should be a way to compare the value of the field with the result of the de-duplicated list such if they are the same there are no duplicates.
eg {{!!field-value}} compaired to list output.

This may be a case of needing to re-frame the question so you can avoid this limitation.

Perhaps you could list all tiddlers containing TH10 in a field and count[] them. If there is more than one you have a duplicate. Basically operate at a tiddler level rather than at a list level.

Regards
Tony

Mark S.

unread,
Jul 26, 2018, 11:44:22 PM7/26/18
to TiddlyWiki
Creating fields for the day/hours might be the way to go. I'll have to rethink it.

This is what I meant about javascript. You know how to get from point A to point B. There's a well established mechanism. Many people have been on similar journeys.

With widgets, I got part way from point A to B, and discovered my vessel had a leak. In this case, the unexpected compaction of lists means that lists don't work like arrays (which up to now has been my guiding comparison).

Oh well, my first algorithm had some flaws, so I was starting over anyways.

Thanks!
-- Mark
Reply all
Reply to author
Forward
0 new messages