[TW5 Plugin] JsonMangler v2.2.3 Released!

151 views
Skip to first unread message

Joshua Fontany

unread,
Sep 26, 2020, 7:32:15 PM9/26/20
to TiddlyWiki
This release ads two new filter operators: "comparefield[]" and "compareindex[]" operators that function as "compare[]" on a specific field or index. The first prefix is now the field or index name. See the help documentation in the example wiki.

Requires TiddlyWiki v5.1.23-pre

I now have a new domain that hosts all my wiki experiments. The demo wiki for this plugin is now located at: https://chronicles.wiki/TW5-JsonMangler/


Best,
Joshua Fontany

Werner

unread,
Sep 28, 2020, 12:27:16 PM9/28/20
to TiddlyWiki
Joshua, thanks for providing and caring for JsonMangler. Two stupid noob questions.

- couldn't "compareindex[]" be achieved with getindex[]compare[]? Or have I got something wrong?
- is something like  [[Test]compareindex:<myIndex>:number:eq[3]]  legit? e.g. when I want to dynamically create the field name?

Thanks, Werner

Joshua Fontany

unread,
Sep 28, 2020, 8:39:44 PM9/28/20
to TiddlyWiki
Hi Werner,

Great questions!

  • couldn't "compareindex[]" be achieved with getindex[]compare[]? Or have I got something wrong? 
    • You could use that syntax, but unfortunately the text returned would be the value of the getindex[/index] operator, NOT the tiddler title.
    • The new syntax allows "[[Test]compareindex:/value:number:eq[3]]" to return [[Test]] instead of "3".
  • is something like  [[Test]compareindex:<myIndex>:number:eq[3]]  legit? e.g. when I want to dynamically create the field name?
    • No, unfortunately, as it is part of the operator suffixes, you cannot use the normal variable/translcude braces.
    • In order to dynamically pass a field or index, set it as a variable (here transcluded from a tiddler's text field), then call the macro to build the final filter:

      \define dynamicCompareFieldFilter()
      [<currentTiddler>comparefield:$(field)$:number:eq[3]]
      \end 

      <$tiddler tiddler="Test">
      <$set name="field" value={{FieldSourceTiddler}}>
      <$list variable="show" filter=<<dynamicCompareFieldFilter>> />
      </$set>
      </$tiddler>
Best,
Joshua F

Werner

unread,
Oct 1, 2020, 1:35:39 PM10/1/20
to TiddlyWiki
Oh, ok, I get it. So far, I have helped myself out with something like

<$list filter="[tag[theTag]type[application/json]search:text<theItem>]">

but compareindex[] obviously provides a way through the front door. 

Great, thanks.
Werner



Reply all
Reply to author
Forward
0 new messages