Presenting: fields2table

560 views
Skip to first unread message

Mat

unread,
Jun 19, 2019, 10:25:12 AM6/19/19
to TiddlyWiki
The chief tiddleur of TWaddle Imperial proudly presents...
...an oh' so elegantly titled little macro:


This is a smallish macro to create a table, based on filtered tiddlers field values.
It is particularly simple to specify what fields to show in the table 
and to manually edit the values.

<:-)

K500 L501

unread,
Jun 19, 2019, 11:26:35 AM6/19/19
to tiddl...@googlegroups.com
"smallish macro", like the man who said:
I invented this smallish thing, I'll call it "screw driver"

Our Gratitude shall cast gloden rays on the paths of you life,
Oh Great Imperial Highness!!

Kilo

PS: this will become standard in my TWs as of this evening!


--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/2eb68b82-ea34-4400-880a-fdfaae24defe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Gifford

unread,
Jun 19, 2019, 12:42:06 PM6/19/19
to TiddlyWiki
Great! Added to the Tables, charts and graphs section of the Toolmap - https://dynalist.io/d/zUP-nIWu2FFoXH-oM7L7d9DM

Watt

unread,
Jun 19, 2019, 1:33:01 PM6/19/19
to TiddlyWiki
Thanks for this Mat,
Got a problem on edit though. I'm losing the contents of my list field after clicking on the edit pen (top left on the table), then clicking it again to save.

Field names look correct and I get the same result on your demo site.

I used <<fields2table "[tag[proj]]">> in a tiddler with a list field containing 'event url' and another tiddler with fields event and url, populated.

The table appears fine but clicking the edit pen twice empties the list field for me.

Anybody else with the same experience?

Mat

unread,
Jun 19, 2019, 2:12:35 PM6/19/19
to TiddlyWiki
K500 and David, thanks for your kind words!

Watt, thanks for reporting. Could you please try it now again. (I have changed the action/uncheckactions arguments.)

<:-)

Mat

unread,
Jun 19, 2019, 2:14:23 PM6/19/19
to TiddlyWiki
Watt - darn, wait with the testing.


<:-)

Mat

unread,
Jun 19, 2019, 2:28:36 PM6/19/19
to TiddlyWiki
@Watt

OK, now please test again, if you'd be so kind.

<:-)

Watt

unread,
Jun 19, 2019, 3:06:43 PM6/19/19
to TiddlyWiki
Working! Thanks very much Mat, it's very useful!

Mat

unread,
Jun 19, 2019, 3:27:29 PM6/19/19
to TiddlyWiki
Watt wrote:
Working! Thanks very much Mat, it's very useful!

Good to hear.

<:-)

Ste Wilson

unread,
Jun 19, 2019, 5:15:40 PM6/19/19
to TiddlyWiki
Ooohhh.. That's cool..
This might be the thing for a materials database... Hmmm

TonyM

unread,
Jun 19, 2019, 6:58:29 PM6/19/19
to TiddlyWiki
Mat,

Nice share. I have build something similar but more complex, I like this straightforward solution.

I note that if we add 
<<tag demo>>
next to your demo table we can change the order of items with the tag pill.

I have done similar presenting a drag and drop to change column order as well, which is simply reordering the list field. This has made me think
  • If we had an equivalent to the tag macro that operated like a tag pill but to control the order of a named field (list by default) it would be very helpful
In my grander designs I am working to define fields such that they are handled differently according to read-only, view, edit and update modes for the whole wiki or individual tiddler.

Thanks
Tony

Mat

unread,
Jun 19, 2019, 8:24:17 PM6/19/19
to TiddlyWiki
TonyM wrote:
Mat,

Nice share. I have build something similar but more complex, I like this straightforward solution.

I note that if we add 
<<tag demo>>
next to your demo table we can change the order of items with the tag pill.

Yes, that should work if the table is in the demo tiddler where the list field is.


  • If we had an equivalent to the tag macro that operated like a tag pill but to control the order of a named field (list by default) it would be very helpful
Yes, that is a very nice idea. I find the DnD mechanism in TW tricky to work with so if we had a ready made macro to apply it to any field, that'd be useful. An even neater idea would be if the items in the to-be-manipulated field could be arbitrary. Instead of a string in a list, it could be whatever is between two markers like a div with a certain class or ID or so. Instead of <<tag foo>> it'd be <<dnd foo>> where foo is the identifying mark for all the segments. In contrast to <<tag>>, I'm not sure if that construct should display show something beyond the items being DnD'able. 

 
In my grander designs I am working to define fields such that they are handled differently according to read-only, view, edit and update modes for the whole wiki or individual tiddler.

Yes, I think we both feel that fields are still way under-exploited. 

<:-)

TonyM

unread,
Jun 19, 2019, 9:01:26 PM6/19/19
to tiddl...@googlegroups.com
Mat,

While fields2table is fresh in your mind, perhaps you could build a data2table that does the same for key value pairs in a data tiddler?

With the fields issue, I have also identified there will always be more fields than there are field types, in fields2table you are using the same field type of text for every field. But we could have say a date field type that we assign to one or more date fields.

Thus to handle fields well we need to provide a set of field types which can be assigned to one or more fields when they are defined. Field type will define how to view or edit fields with that type.

Regards
Tony

Mohammad

unread,
Jun 19, 2019, 10:27:12 PM6/19/19
to TiddlyWiki
Great job!
Creating table in wiki text when table has many entries is always a tedious task!
This work simplifies the task.

I think it may simply extended to cover data-tiddlers

Thank you
Mohammad

bimlas

unread,
Jun 20, 2019, 2:16:30 AM6/20/19
to TiddlyWiki
Mat,

Before that I used Dynamic Tables, which is very similar to your plugin, but yours is a bit faster. You might have to talk to Jed to create The One and Only Table Plugin. :D

Mat

unread,
Jun 20, 2019, 3:43:47 AM6/20/19
to TiddlyWiki
Muhammad (and Tony), yes do go ahead and make it work for datatiddlers. I don't think it should be difficult.

Tony, about field types and therefore adapting the type of editor: One super simple step might be to, in the current macro, merely exchange the EditTextWidget instances for EditWidget instances. I just never use the latter even if it is more general, possibly because of the limited parameter options. 

For manual control of field type, per column or even per cell, one could imagine a small dropdown button to the right in each column header in edit mode where a field type is set.

<:-)

Mat

unread,
Jun 20, 2019, 3:50:16 AM6/20/19
to TiddlyWiki
bimlas wrote:
Before that I used Dynamic Tables, which is very similar to your plugin, but yours is a bit faster.

The name says it; His is much more dynamic and powerful :-) I think it is a matter of what it is you need control over.

<:-)

HC Haase

unread,
Jun 20, 2019, 6:06:29 AM6/20/19
to TiddlyWiki
This is very nice. simple and fast and easy. I have to see what to use it for now!

Here is a fancy text snippet for fields2table with some counting stuff.


Feature request:
 
 * It is nice that you can change the order of the fields just by rearranging the field names. It would be superb if the first column could also be moved at will in this manner. My use case is my reading list. It has tittlers with title:bookTitle and genre:TheGenre. I would like to have the genre in the first collumn in a table of books (genre has no tiddler).
$__tags_TextEditor_Snippet_fields2table.json

Mat

unread,
Jun 20, 2019, 7:32:45 AM6/20/19
to TiddlyWiki
HC Haase wrote:

Here is a fancy text snippet for fields2table with some counting stuff.

I'll look into it, hopefully over the weekend. 


Feature request:
 
 * It is nice that you can change the order of the fields just by rearranging the field names. It would be superb if the first column could also be moved at will in this manner. My use case is my reading list. It has tittlers with title:bookTitle and genre:TheGenre. I would like to have the genre in the first collumn in a table of books (genre has no tiddler).

I can think of a few ways to do this. I mean, it is easy to do it if one accepts a lot more complexity to the code but one idea I have is mostly CSS based. At least if you don't demand links for the categories. In short, you'd prefix every title link with the genre by means of css (use :before {content:"$(category)$"} ). To avoid showing this before every single item but instead only when the (category sorted) list goes from one category to the next, you can hide all but the first element (basically first-of-type(:not) display:none ...I forget the exact syntax). 

Another idea would be to, in the list field, just write "genre title....". That gives you an extra title column (but the title is not a link.. and note that you must not edit the title there as it changes its identity!). Then, tweak the stylesheet to change the original (leftmost) title-links to instead appear as some small link icon to the book. 

As I said, you can do it "for real" if you accept a more complexity in the actual code.

<:-)

TonyM

unread,
Jun 20, 2019, 10:09:43 AM6/20/19
to TiddlyWiki
Are we only talking about the order of the columns/fields in the table?

If so I already have a simple solution. I have done it before. So just ask. If not, if I am missing something ignore this offer.

Tony

HC Haase

unread,
Jun 21, 2019, 2:00:18 AM6/21/19
to TiddlyWiki
@Mat
Another idea would be to, in the list field, just write "genre title....". That gives you an extra title column (but the title is not a link.. and note that you must not edit the title there as it changes its identity!). Then, tweak the stylesheet to change the original (leftmost) title-links to instead appear as some small link icon to the book.

of course.. That is a simple solution. But is this best controlled in the style sheet?  I have made this modification but in the $:/_TWaddle/fields2table tiddler, not the stylsheed. Is this bad practice??

anyway I have made one edition with the link icon from TW as the link. This however looks a bit big to me so I also made an edition with an arrow as the link. however I dont understand why the first row display the title as a link, but the rest is not.

@ TonyM
If you have some elegant solution please share :)
$___TWaddle_fields2table_arrow.json
$___TWaddle_fields2table_pic.json

HC Haase

unread,
Jun 21, 2019, 2:14:16 AM6/21/19
to TiddlyWiki

of course.. That is a simple solution. But is this best controlled in the style sheet?  I have made this modification but in the $:/_TWaddle/fields2table tiddler, not the stylsheed. Is this bad practice??

anyway I have made one edition with the link icon from TW as the link. This however looks a bit big to me so I also made an edition with an arrow as the link. however I dont understand why the first row display the title as a link, but the rest is not.

hmm... I see a weakness in this modification now. If you have a table with few columns, say 2, then you get a very wide left column only containing an arrow... but who has small tables anyway

@TiddlyTweeter

unread,
Jun 21, 2019, 3:03:49 AM6/21/19
to TiddlyWiki
Mon cher Mat Leur,

Très élégant!

Bonjour
Joseur

Hans Wobbe

unread,
Jul 13, 2020, 5:26:51 PM7/13/20
to TiddlyWiki
Mat:

I've been making a lot of use of your Fiels2Table macro, so I thought I should really take to moment to express my appreciation for this and the your many other contributions to the Community.  Note only am I an appreciative User but, better yet, I've also learned from reviewing your techniques.

I recently stumbled onto another macro on one of your web sites.  I was pleased at the time, but got distracted before I could really investigate it or even properly bookmark it.  At this time, all I remember is that it was related to VARs and that it created another set of fields, above the "text" field.  I have tried searching and failed.  A Hint or link would be appreciated.

Regards,
Hans

Mat

unread,
Jul 14, 2020, 6:25:05 AM7/14/20
to TiddlyWiki
Hans, happy to hear you have use of my gizmos.


I recently stumbled onto another macro on one of your web sites.  I was pleased at the time, but got distracted before I could really investigate it or even properly bookmark it.  At this time, all I remember is that it was related to VARs and that it created another set of fields, above the "text" field.  I have tried searching and failed.  A Hint or link would be appreciated.

I'd guess you're referring to http://configsfields.tiddlyspot.com/

<:-)

Hans Wobbe

unread,
Jul 14, 2020, 7:50:17 AM7/14/20
to TiddlyWiki
Thank you, Mat.  That is indeed what I was looking for.

I think I can make good use of this in a couple of my Contexts.  If that works out, I will post back to share the ideas.

<:)


On Tuesday, July 14, 2020 at 6:25:05 AM UTC-4 Mat wrote:
Hans, happy to hear you have use of my gizmos.
 
...

Mat

unread,
Jul 14, 2020, 8:06:42 AM7/14/20
to TiddlyWiki
Hans Wobbe wrote:
Thank you, Mat.  That is indeed what I was looking for.

Great. Otherwise I just realized that it might have been this one which has similarities: http://varsfields.tiddlyspot.com/ 

I think I can make good use of this in a couple of my Contexts.  If that works out, I will post back to share the ideas.

Excellent, keep on sharing.

<:-)
Reply all
Reply to author
Forward
0 new messages