Display date last modified of a field?

77 views
Skip to first unread message

Aaron Haslem

unread,
Feb 4, 2020, 4:19:11 PM2/4/20
to TiddlyWiki
I want to display the contents of a field and the date that it was last modified.  Displaying the field contents I understand.  But, is there a way to display when a field was last modified?  I know I can display the last modified date of a tiddler.  If there isn't a way, what would be the best way of updating a date field associated with a field?
For example. I have a field called Revision.  I use the edit-text widget and button widget to update Revision.  Is there a way to update a RevDate field that would populate with todays date whenever Revision is modified?

Mat

unread,
Feb 4, 2020, 4:30:48 PM2/4/20
to TiddlyWiki
Sure, as you note in the subtitle for each tiddler there's a "last modified date" which is actually just data in a field, albeit hidden, named "modified". So if you do {{!!modified}} you've got it. If you want the date presented in some specific format, use the  https://tiddlywiki.com/#ViewWidget and https://tiddlywiki.com/#DateFormat

<:-)

Aaron Haslem

unread,
Feb 4, 2020, 4:55:28 PM2/4/20
to TiddlyWiki
Thanks Mat,  your answer addresses the date modified of a tiddler.  I have tiddlers with a couple dozen fields.  There are couple of fields that will, for the most part, stay fixed once they are populated.  Yet, there are a couple fields that I will use to make recipe changes on experiments I am doing.  Thus, its possible that I will make subtle changes to different fields over several weeks.   I would like to show when each field was modified, not just the overall tiddler.
For example:
Tiddler Title:  Chocolatte Springs
Recipe Step 1: 1.50 Modified on June 25, 2020
Recipe Step 2: 2.35 Modified on July 23, 2020
Recipe Step 3: 0.89 Modified on June 23, 2020

I can brute force the date in with each recipe field change.  But I would like the date to simply update each time I change a Recipe Step contents.

Eric Shulman

unread,
Feb 4, 2020, 4:57:41 PM2/4/20
to tiddl...@googlegroups.com
On Tuesday, February 4, 2020 at 1:19:11 PM UTC-8, Aaron Haslem wrote:
I want to display the contents of a field and the date that it was last modified.  Displaying the field contents I understand.  But, is there a way to display when a field was last modified?  I know I can display the last modified date of a tiddler.  If there isn't a way, what would be the best way of updating a date field associated with a field?
For example. I have a field called Revision.  I use the edit-text widget and button widget to update Revision.  Is there a way to update a RevDate field that would populate with todays date whenever Revision is modified?

The $action-setfield widget can update more than one field when pressed.  Thus, for your edit-text and button combination, you could write:
\define setrev() <$action-setfield $tiddler=<<currentTiddler>> rev={{$:/temp/revinput}} revdate=<<now "YYYY0MM0DD0hh:0mm:0ss">> />
<$edit-text tiddler="$:/
temp/revinput" tag="input" default="" />
<$button actions=<<setrev>>> set revision </$button>

Note: use the actions=... button parameter to invoke the action-setfield widget.  This allows the value of revdate to be calculated each time the button is pressed.

enjoy,
-e



Aaron Haslem

unread,
Feb 4, 2020, 4:59:17 PM2/4/20
to TiddlyWiki
Thanks Eric, I will give that a shot and report back.


On Tuesday, February 4, 2020 at 4:19:11 PM UTC-5, Aaron Haslem wrote:

Aaron Haslem

unread,
Feb 4, 2020, 5:13:28 PM2/4/20
to TiddlyWiki
This is promising.
How do I pass a variable field to the setrev macro? Right now, this creates or updates the field "rev" and "revdate"  this is great, thanks.  How would I pass in the <<setrev>> call a variable fieldname?
For example:
Step1  Step1date
Step2 Step2date
Step3 Step3date

I envision setting this in a table with the Recipe directions and an Modify Button for each step.  I imagine sending the setrev macro would be more efficient if I could send it the field "Step1" and "Step1date" then "Step2" and "Step2date" etc.  than defining this macro for each Step field.


On Tuesday, February 4, 2020 at 4:19:11 PM UTC-5, Aaron Haslem wrote:

Aaron Haslem

unread,
Feb 4, 2020, 5:18:16 PM2/4/20
to TiddlyWiki
Here's where I am at now.

\define setrev() <$action-setfield $tiddler=<<currentTiddler>> rev={{$:/temp/revinput}} revdate=<<now "YYYY0MM0DD0hh:0mm:0ss">> />

Step 1{{!!step1}} {{!!step1date}}<$edit-text tiddler="$:/temp/revinput" tag="input" default="" /><$button actions=<<setrev>>> Update Step 1 </$button><br>
Step 2{{!!step2}} {{!!step2date}}<$edit-text tiddler="$:/temp/revinput" tag="input" default="" /><$button actions=<<setrev>>> Update Step 2 </$button><br>
Step 3{{!!step3}} {{!!step3date}}<$edit-text tiddler="$:/temp/revinput" tag="input" default="" /><$button actions=<<setrev>>> Update Step 3 </$button><br>
Step 4{{!!step4}} {{!!step4date}}<$edit-text tiddler="$:/temp/revinput" tag="input" default="" /><$button actions=<<setrev>>> Update Step 4 </$button><br>

Eric Shulman

unread,
Feb 4, 2020, 6:16:20 PM2/4/20
to tiddl...@googlegroups.com
Give this a try: 
\define showrev(id,label)
$label$ {{!!$id$}} {{!!$id$date}} <<getrev id:"$id$" label:"$label$">>
\end

\define getrev(id,label)
<$edit-text tiddler="$:/temp/$id$" tag="input" default="" />
<$button actions=<<setrev id:"$id$">>> Update $label$ </$button>
\end

\define setrev(id)
<$action-setfield $tiddler=<<currentTiddler>> $id$={{$:/temp/$id$}} $id$date=<<now "YYYY0MM0DD0hh0mm0ss">> />
\end

<<showrev id:"step1" label:"Step 1">>
<<showrev id:"step2" label:"Step 2">>
<<showrev id:"step3" label:"Step 3">>
<<showrev id:"step4" label:"Step 4">>

Let me know how it goes...

enjoy,
-e

TonyM

unread,
Feb 4, 2020, 6:55:17 PM2/4/20
to TiddlyWiki
Aaron

From your original post I imagin it is clear now that there is no date field associated with each field in a tiddler only the created and modified dates for the tiddler as a whole.

In some operations it is possible to change the value of a field without touching the modified date. But this is not what you are looking for, it may prove useful in the future. Look for timestamp parameters or in side bar tools where to can switch it off for the whole wiki.

If the suggestions already solve your problem no need to read on.

I believe it would be easy to maintain a last modified date for each field if you desired, but you would need control the methods used to modify the fields so your field timestamp gets updated.

How would I approach this? Maintain a separate qualified system tiddler for each tiddler where the fields in it contain the last modified date for the matching field on that tiddler.

Just ask if taking this path is desirable.

Tony

Aaron Haslem

unread,
Feb 5, 2020, 11:52:36 AM2/5/20
to TiddlyWiki
Eric,
Thats awesome!  I can work with this.  Already have other ideas for how to use what you are showing here.  I am not a code person, so I did not realize the $id$ use as a means of using and passing a variable.  Thanks!  Very handy.

Tom, Yes.  From Eric's responses I came quickly to the conclusion that there was not a dedicated modified date for fields.  Your method sounds interesting but, I use a lot of template tiddlers (as I will with this use also) to display information in a uniform manner.  In this instance, I would think that having a dedicated system tiddler keeping track of the modified date would make juggling several dozen tiddlers, all using the same template, a little difficult....unless Im not understanding very well the concept you are proposing.

Thanks for the input Gents.

TonyM

unread,
Feb 5, 2020, 6:08:18 PM2/5/20
to TiddlyWiki
Aaron,

My suggestion includes how I would do it, 
I believe it would be easy to maintain a last modified date for each field if you desired, but you would need control the methods used to modify the fields so your field timestamp gets updated.

The design concept I have should not add complexity to your templates only "the methods used to modify the fields so your field timestamp gets updated"

But if you are content with the current solutions, we have no need to go down this path.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages