Adding text to newly imported tiddlers

91 views
Skip to first unread message

Robert Jopling

unread,
Jun 29, 2020, 3:57:45 PM6/29/20
to TiddlyWiki
How do you add new text to the body of all newly imported tiddlers?

TW Tones

unread,
Jun 29, 2020, 9:38:21 PM6/29/20
to TiddlyWiki
Robert,

  • Do you want this to be appended, pre-pended or overwrite the text?
  • Is this text common for all, or do you wish to edit it before adding to each tiddler?

We can make a full solution, but the first thing is to keep the list of tiddlers imported. After import if you rename $:/import to another name you can keep the list of tiddlers.

I will come back soon with a way to extract those titles to use for further transformation.

Regards
Tony

TW Tones

unread,
Jun 29, 2020, 9:45:40 PM6/29/20
to TiddlyWiki
Robert,

If you renamed $:/import to "Keep" after import. You can access the links to each imported tiddler with the following list widget

<$list filter="[[Keep]links[]]">

</$list>

Once you have this you can can use a button and actions within the button, use this list inside the button to apply the same change to each tiddler.

More details once I know what you want to do as per my first reply.

Regards
TW Tones

Mat

unread,
Jun 30, 2020, 4:09:04 AM6/30/20
to TiddlyWiki
As Tony notes, is it the same text that is to be inserted for them all?
Would it be OK if it was really inserted via a viewtemplate rather than to manipulate the text field? This would appear the same when you look at the tiddler. A viewtemplate solution would be simpler but the text would e.g not register in standard "search"... (which might be a good thing if it is a recurring text.)

<:-)

Robert Jopling

unread,
Jun 30, 2020, 5:40:56 AM6/30/20
to tiddl...@googlegroups.com
Hello

Thank you for responding to my query. It is probably worth outlining what i am trying to achieve. I have some data in a database and, with Eric's help, I have transferred that data via JSON into a number of tiddlers with data in a number of fields. To see the data I have to add the same text to the body of every tiddler so I would like to add that text to the new tiddlers on import. Possibly a different solution to the problem that I outlined in my first email.

Does that help?

Rob

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/6a1ad222-79a5-4ff3-90b2-174da334784bo%40googlegroups.com.

Robert Jopling

unread,
Jun 30, 2020, 5:43:40 AM6/30/20
to tiddl...@googlegroups.com
Tony

Many thanks for responding to my query.

This is what i am trying to achieve. I have some data in a database and, with Eric's help, I have transferred that data via JSON into a number of tiddlers with data in a number of fields. To see the data I have to add the same text to the body of every tiddler so I would like to add that text to the new tiddlers on import. Possibly a different solution to the problem that I outlined in my first email.

So in answer to your questions:
1. The body is empty so it does not matter
2. Yes, common to all.

I hope this helps and many thanks.

Rob

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

Mat

unread,
Jun 30, 2020, 5:57:12 AM6/30/20
to TiddlyWiki
@Robert, is there any other commonality - besides that they're all imported - among the relevant tiddlers? For example, do they happen to be tagged in a specific way that is unique for all tiddlers where you want this text to show, or are they all prefixed in some way or do they all have some shared uniquely titled field?

And will you use the appearing text other than viewing it? Should it be findable in regular search? Will you transclude it elsewhere?

IF your reply is that "they all share the common trait X" and "it doesn't have to be findable in regular search" then the problem is very simple to solve. It is solvable regardless, but IF those criteria are met then it's really simple. Just sayin.

<:-)

Robert Jopling

unread,
Jun 30, 2020, 6:19:40 AM6/30/20
to tiddl...@googlegroups.com
In response

1. Yes they are all tagged the same
2. Yes they would need to be findable in a regular search

I hope this helps

Rob

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

Mat

unread,
Jun 30, 2020, 7:49:34 AM6/30/20
to TiddlyWiki
OK, modify this and see if it works:

\define append()
$
(text)$

My added text

*one
*two
\end

<$button>
clicketyclick
<$list filter="[tag[HelloThere]]">
<$set name=text value={{{ [{!!title}get[text]] }}}>
<$action-setfield $tiddler={{!!title}} text=<<append>> />
</
$set>
</$list>
</
$button>

<:-)

Robert Jopling

unread,
Jun 30, 2020, 7:58:25 AM6/30/20
to tiddl...@googlegroups.com
Thanks Mat. Really appreciate it.

Will give it a go and let you know how i get on

Cheers

Rob

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

TW Tones

unread,
Jun 30, 2020, 8:10:59 AM6/30/20
to TiddlyWiki
A view template to support viewing your tiddlers should be all that's needed.

If the data is not private can you share it in a private reply? There are plenty of ways to automate this without appending anything.

Regards
Tony

Robert Jopling

unread,
Jun 30, 2020, 7:08:41 PM6/30/20
to tiddl...@googlegroups.com
Hi Mat

That worked a treat. Thank you so much.

Rob

On Tue, 30 Jun 2020 at 12:49, Mat <matia...@gmail.com> wrote:
--
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.

Mat

unread,
Jul 1, 2020, 4:32:28 AM7/1/20
to TiddlyWiki
@Robert, I just realized something to be careful with: Make sure the filter includes something so that it is only the newly imported tiddlers and not old tiddlers that already have the inserted text. I.e add some date criteria in the filter. I can't recall exactly how to do this but you can do a search in the forum. You can probably make it generic by making the date be todays date (using the "now" macro)

<:-)

Robert Jopling

unread,
Jul 1, 2020, 5:26:20 AM7/1/20
to tiddl...@googlegroups.com
Thanks Mat for that advice. 

Your solution works great for my purposes and has taught me something as well. 

Rob

On Wed, 1 Jul 2020 at 09:32, Mat <matia...@gmail.com> wrote:
@Robert, I just realized something to be careful with: Make sure the filter includes something so that it is only the newly imported tiddlers and not old tiddlers that already have the inserted text. I.e add some date criteria in the filter. I can't recall exactly how to do this but you can do a search in the forum. You can probably make it generic by making the date be todays date (using the "now" macro)

<:-)

--
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.
Reply all
Reply to author
Forward
0 new messages