Sort by size?

165 views
Skip to first unread message

Mat

unread,
Sep 11, 2017, 7:15:11 PM9/11/17
to TiddlyWiki
Summary: I'd like to sort my tids by size and am wondering if anyone has a solution for this?

Longer:

I'm in the process of converting my main TWC with thousands of tiddlers into TW5, and it struck me as a good opportunity for cleaning.

To make the most out of this, I'd like to sort my tids by size. The ideal would be to know the byte size per full tiddler, but I guess character count per tiddlers text-field is pretty close.

Any ideas?

------------------------------------------

Note: I found Thomas Elmigers EditorCounter with which I can get a count:title listing... 

<$list filter="[tag[Foo]]">
<$editor-counter tiddler={{!!title}} field=text /> {{!!title}}
<br>
</$list>

...but it is not sorted.

Now how to use that count for sorting is really another problem, so I'm posting a question for that separately. But I still wanted to mention Thomas' plugin in case someone has an idea how to use it for my problem.

Thank you.

<:-)



Mark S.

unread,
Sep 11, 2017, 7:42:05 PM9/11/17
to TiddlyWiki
I'm thinking of a 2-step process.

In step 1, you calculate the size of the text field and put it in a field (e.g. size).

Then step 2 you simply sort numerically by the size field.

So how to get the count?

You can use the regexps string I presented in another thread to globally split the entire text field character-by-character. Use the count filter operator to count the resulting size. Use action-setfield to save the resulting value. This entire process is called in an outer <$list> for each of the items you want to include in your sort.

It's lazy of me not to try all this, but I know you can write the TW-code faster than I can ;-)

HTH
Mark

Mat

unread,
Sep 11, 2017, 8:27:47 PM9/11/17
to TiddlyWiki
Thanks for reply Mark!

 
I'm thinking of a 2-step process.

In step 1, you calculate the size of the text field and put it in a field (e.g. size).

Hm, that would modify every tiddler then and mess up their dates. Maybe I could copy each title and the size of it, into some dictionary or sth.

I'll do some further thinking and maybe someone else has more ideas. I also have a hunch that Tobias' might have something that could solve this. I think he had some plugin or widget that allowed two step filters. Will look tomorrow.


... I know you can write the TW-code faster than I can ;-)

Ha ha! I'm often impressed by your attention to detail, but you're way off here. My bang-my-head approach usually takes absolutely embarrassing lengths of time.

<:-)

Mark S.

unread,
Sep 11, 2017, 8:50:37 PM9/11/17
to TiddlyWiki
Hi Mat,

You can use the $timestamp attribute of action-setfield to prevent the date from being modified.

Mark

Birthe C

unread,
Sep 11, 2017, 9:25:48 PM9/11/17
to TiddlyWiki

Mat

unread,
Sep 12, 2017, 1:47:06 AM9/12/17
to TiddlyWiki
Birthe C wrote:

Birthe - that was exactly it! Stephan Hradek had a created the exact things needed and presented by Tobias Beer.

(This also reminded me that I was sloppy in checking the archives!)

Thank you Birthe!!! And thanks again Mark.

<:-)

magev958

unread,
Sep 12, 2017, 2:42:56 PM9/12/17
to TiddlyWiki
Reply all
Reply to author
Forward
0 new messages