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


On Sunday, 28 June 2020 13:51:57 UTC+1, Eric Shulman wrote:
>
> 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
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1d59bd1b-3a6a-47bd-94ae-a6e28425b76do%40googlegroups.com.

Reply via email to