Help deleting a problematic user field

152 views
Skip to first unread message

Jalen MichalsLevy

unread,
Apr 9, 2020, 11:13:28 AM4/9/20
to TiddlyWiki
Hi there, 

Apparently somewhere in learning TiddlyWiki, I seem to have created two user fields, one named "" and the other named ="". Now, I am aware that these characters are not allowed in the field name, so I am unsure how they got there in the first place. It has not been a problem until now, when I tried to add Tobias Beer's Search In Field functionality, which can be found here: http://tobibeer.github.io/tb5/#Searching%20In%20Tiddler%20Fields. The search works well, except that it also provides a syntax error which I am pretty sure is due to these fields. In the following example, I am searching for the term 'book' in all fields. This seems to work properly at the bottom, listing the 'caption' field for the tiddler "Wisanthrope Spells", which has the term 'book' in it. Clearly, however, at the top, it reveals erroneous list widget syntax. I think the system is having trouble reading a field named ="" or "" right after the regexp operator. I cannot for the life of me find any tiddlers which have these fields nor can I figure out how I made them, since when I try to use them now, it tells me that these characters are not allowed in the field name. Is there any way to just delete them outright? If not, how would you identify which tiddlers have these fields active? Thanks in advance!

<$list filter="[!is[shadow]!is[system]regexp:=""[book(?i)]limit[1]]">

=""
</$list> <$list filter="[!is[shadow]!is[system]regexp:=""[book(?i)]]">
</$list>

<$list filter="[!is[shadow]!is[system]regexp:""[book(?i)]limit[1]]">

""
</$list> <$list filter="[!is[shadow]!is[system]regexp:""[book(?i)]]">
</$list>
caption

Mat

unread,
Apr 9, 2020, 12:46:11 PM4/9/20
to TiddlyWiki
The field names make them such that they may be problematic to locate programatically but here's a first try:

<$button>
<$action-deletefield $tiddler=xxx $field="" />
</$button>

Now with that failed attempt out of the way, I suggest you:

add an easily findable field, say "xxxxxx:yyyyy" to the faulty tiddlers and then open your html file in an editor (e.g Notepad++ ) and search for that field and, next to it, try to locate the faulty fields and carefully remove them making sure not to remove anything else. OF COURSE YOU BACK UP YOUR STUFF BEFORE ANY OF THIS.

The "" might have been converted into &quot;&quot; in the code, you'll have to investigate a little.

<:-)

Jalen MichalsLevy

unread,
Apr 9, 2020, 1:10:18 PM4/9/20
to TiddlyWiki
Thanks for the quick reply! If I understand you correctly, you are suggesting that I put an easily findable field in with a tiddler that has one of these bad fields.  Unfortunately I am not sure which tiddlers have these bad fields in the first place. As of now, there are no tiddlers that are faulty per se. Everything seemed to be working perfectly until I added this extended search functionality. The search functionality still works, but I don't like the aesthetics of the weird syntax showing up. It also makes me worry that these bad fields are going to cause unforeseen problems in the future. I tried opening the html file in a text editor (i am on a mac so i don't have notepad) and it only shows a list of the tiddlers that are contained. How do I open it so it shows me raw text? Thanks for helping! I've done a lot of coding in tiddlywiki so far but i still feel like a total newbie at most of this stuff.

Mat

unread,
Apr 9, 2020, 1:47:35 PM4/9/20
to TiddlyWiki
You're right in that such faulty field names - if indeed there are any - can cause unforeseen problems.

Just maybe(!) doing this will at last give some clue:

<$list filter="[all[tiddlers]fields[]]">

</$list>

Notepad++ is a text editor, not a word processor, so you'd need a text editor. Google search shows some software called TextWrangler for Mac.

<:-)


TonyM

unread,
Apr 9, 2020, 9:18:56 PM4/9/20
to TiddlyWiki
Jalen,

Keep in mind if you can't fix this internally within tiddlywiki, take a copy of the html file and use a good editor like notepad++ and search and replace such bad fieldnames in there. Always do find then replace and make sure the partern is found in the correct place so you don't hit unwanted cases.

Regards
Tony

Mark S.

unread,
Apr 9, 2020, 10:55:05 PM4/9/20
to TiddlyWiki
We're at a bit of a disadvantage in this case, not being able to see your data. In order to reconstruct
your situation, I had to use a text editor and create a bad field. I was then able to find it using this code:


<$vars quote='"'>
<$list filter="[all[tiddlers]]" variable="title">
<$list filter="[
<title>fields[]regexp<quote>limit[1]]" >
Bad? :  <
<currentTiddler>><<title>> <br/>
</$list>
</$list>
</$vars>

This should find any standard tiddler with a field name contain a quote.  The complication is that your actual field might not contain a quote symbol -- it might contain the html version of quote: &quot;

So if the first search doesn't find anything, try changing variable "quotes" to "&"

Good luck!

Mohammad

unread,
Apr 10, 2020, 4:10:45 AM4/10/20
to TiddlyWiki
While other people here have given good solution, but one simple is Tiddler Commander!
If you have it installed you can simply delete those bad field name with few clicks!


Example : list all tiddlers using [all[tiddlers]], then from Field tab, Remove fields, open drop down and see invalid field name!

While Tiddlywiki does not allow add field with invalid name, BUT you can do this programatically!



--Mohammad

Jalen MichalsLevy

unread,
Apr 10, 2020, 12:19:42 PM4/10/20
to tiddl...@googlegroups.com
Thank you everyone here for your help! Since I couldn't think of any reason these fields would have shown up from something I had done, I decided to make a new file and systematically add plugins until the bad field showed up. I was able to see all of the fields by using a tiddler with what Mat suggested. Thanks Mat! I also added a line for shadow tiddler fields: 
<$list filter="[all[tiddlers]fields[]]" />

<hr>

<$list filter="[all[shadows]fields[]]" />


I was able to narrow down the problem to a specific plugin that I had installed which had many tiddlers which all came with these strange fields. The plugin is "D&D 5e SRD Monsters", in case anyone is wondering. Super useful tool if you are into Dungeons and Dragons! I will probably email the author and let them know of this issue once I can confirm that it was definitely something on their end. I used trial and error, but in case this comes up in the future, I used the suggestion that Mark S. put forward for locating tiddlers that have the bad fields. It worked perfectly once I extended the filter to include shadows as well. Thanks for that! Finally, Mohammed, thank you for introducing me to the extremely useful tool of TW-Commander. Unfortunately it did not work as the bad field names messed with the button that would have removed the field. Looking back on it, it is possible that it did work, but because it doesn't affect shadows, it only changed a select few non-shadow tiddlers that had these faulty fields. The thing that finally worked for me was a button of my own that I adapted from some code I found here: https://tiddlywiki.narkive.com/NmNVbrY5/tw-tw5-can-i-bulk-delete-a-tag. This is the adapted code: 
<$set name="oldField" value={{!!fieldtoremove}}>
<$button>
<$list filter="[all[shadows+tiddlers]]">
<$fieldmangler>
<$action-sendmessage $message="tm-remove-field" $param=<<oldField>>/>
</$fieldmangler>
</$list>
Kill Bad Field
</$button> </$set>

All I had to do was create a field in that tiddler with fieldtoremove as the name and "" or ="" as the value and hit the button. As nerve wracking as it was, this seemed to do the trick! (Don't worry, i have plenty of backup versions just in case this did something bad.) Anyway, hopefully this thread can help other people! 

Thanks again for all the advice!

Mark S.

unread,
Apr 10, 2020, 1:16:54 PM4/10/20
to TiddlyWiki


Looks like maybe all the tiddlers have the field error.

For what it's worth, I submitted an issue report at

Mark S.

unread,
Apr 13, 2020, 10:55:32 AM4/13/20
to TiddlyWiki

Just got a notice that the problem has been fixed.

Jalen MichalsLevy

unread,
Apr 13, 2020, 5:22:35 PM4/13/20
to TiddlyWiki
Wow that is so awesome. Thanks again for the help and reaching out to the author! Glad that this problem could be solved on a larger scale. 
Reply all
Reply to author
Forward
0 new messages