bug ? $action-listops would not copy from another datatiddler if it is negative

30 views
Skip to first unread message

Sebastian Ovide

unread,
Jun 28, 2020, 7:48:17 AM6/28/20
to TiddlyWiki
try this this snipped. It works for positive numbers but not for negatives ones. 
Any ideas ?

<$edit-text  tiddler="weight" index="tmp" tag="input" type="number"/> <$button>
<$action-listops $tiddler="weight" $index="latest" $filter={{weight##tmp}}/>
<$action-listops $tiddler="weight" $index=<<now YYYY0MM0DD0hh0mm0ss>> $filter={{weight##tmp}}/>record
</$button>

weight -> {{weight}}
weight##latest -> {{weight##latest}}

Mat

unread,
Jun 28, 2020, 7:57:40 AM6/28/20
to TiddlyWiki
I didn't study your code but note that e.g the filter {{{ 5 -1 }}} outputs only "5" because as a filter, the minus doesn't mean "negative" but "remove from filter". To get negative number you must write {{{ 5 =-1 }}} or with a = before every item, i.e {{{ =5 =-1 }}}

<:-)

Eric Shulman

unread,
Jun 28, 2020, 8:51:57 AM6/28/20
to tiddl...@googlegroups.com
On Sunday, June 28, 2020 at 4:48:17 AM UTC-7, Sebastian Ovide wrote:
try this snippet. It works for positive numbers but not for negatives ones. 

<$edit-text  tiddler="weight" index="tmp" tag="input" type="number"/> <$button>
<$action-listops $tiddler="weight" $index="latest" $filter={{weight##tmp}}/>
<$action-listops $tiddler="weight" $index=<<now YYYY0MM0DD0hh0mm0ss>> $filter={{weight##tmp}}/>record
</$button>

weight -> {{weight}}
weight##latest -> {{weight##latest}}


Not sure what you are trying to do, but it's unclear to me why you are using $action-listops to write the input into the tiddler.

Perhaps you can just use $action-setfield, like this:
<$edit-text tiddler="weight" index="tmp" tag="input" type="number"/>
<$button> record
<$action-setfield $tiddler="weight" $index="latest" $value={{weight##tmp}}/>
<$action-setfield $tiddler="weight" $index=<
<now YYYY0MM0DD0hh0mm0ss>> $value={{weight##tmp}}/>
</$button>

-e

Sebastian Ovide

unread,
Jun 28, 2020, 9:56:19 AM6/28/20
to TiddlyWiki
thanks Eric. 

I was using action-listops as I've found it in another thread and didn't know that action-setfield could write in datatiddlers.

I wish I've read your answer before !

 in the mean time I managed to use action-listop with this

\define makeAction(tiddler, number) 
  <$action-listops $tiddler="$tiddler$" $index="latest" $filter="=$number$" />
  <$action-listops $tiddler="$tiddler$" $index=<<now YYYY0MM0DD>> $filter="=$number$" />
\end
\define save(tiddler)
  <$macrocall $name="makeAction" tiddler="$tiddler$" number={{$tiddler$##tmp}} />
\end

<$edit-text  tiddler="weight" index="tmp" tag="input" type="number"/><$button>
<$action-listops $tiddler="weight" $index="latest" $filter={{weight##tmp}}/>

<<save weight>>

record
</$button>

weight -> {{weight}}
weight##latest -> {{weight##latest}}
Reply all
Reply to author
Forward
0 new messages