Hi Saq,
Many thanks for clarification
So the magic is the empty string returned by else[]

Thanks again!


On Sun, Mar 21, 2021 at 4:01 PM Saq Imtiaz <saq.imt...@gmail.com> wrote:

> @Mohammad the underyling issue is one that I think we have discussed
> before in another context.
>
> TiddlyWiki filters distinguish between no results from a filter step, and
> an empty string as a result.
>
> When there is no result from a filter step, like with get[text] on a
> non-existent tiddler, the next filter step receives no input and therefore
> the entire filter run will have no output. However, by using else[] we
> specify an empty string as the input to the next step if the previous step
> had returned no result. This allows the addsuffix[] step to return a result.
>
> This is the same reason why we have the is[blank] operator, to distinguish
> between no result, and an empty string as a result.
>
> On Sunday, March 21, 2021 at 11:44:51 AM UTC+1 Mohammad wrote:
>
>> Saq
>> Thank you! works like a charm!
>> Would you please explain what empty else[] does here?
>>
>>
>>
>>
>> Best wishes
>> Mohammad
>>
>>
>> On Sun, Mar 21, 2021 at 12:14 PM Saq Imtiaz <saq.i...@gmail.com> wrote:
>>
>>> Try adding an else[] after <targetTiddler>get[text]
>>>
>>> On Sunday, March 21, 2021 at 5:51:59 AM UTC+1 Mohammad wrote:
>>>
>>>> Lovely solution Saq!
>>>>
>>>> why it does not work with a non-existent Target tiddler? how can I
>>>> extend the code to address this issue?
>>>>
>>>>
>>>> Best wishes
>>>> Mohammad
>>>>
>>>>
>>>> On Sat, Mar 20, 2021 at 11:37 PM Saq Imtiaz <saq.i...@gmail.com> wrote:
>>>>
>>>>> @Diego, this is untested code but should hopefully point you in the
>>>>> right direction:
>>>>>
>>>>> \define appendBoxActions()
>>>>> <$action-setfield $tiddler=<<targetTiddler>> text={{{
>>>>> [<targetTiddler>get[text]addsuffix<linebreak>addsuffix<linebreak>addsuffix{$:/temp/appendbox}]
>>>>> }}}/>
>>>>> <$action-setfield $tiddler="$:/temp/appendbox" text=""/>
>>>>> \end
>>>>>
>>>>> <$vars targetTiddler="Target" linebreak="
>>>>> ">
>>>>> <$keyboard key="Enter" actions=<<appendBoxActions>>>
>>>>> <$edit-text tag="textarea" placeholder="" tiddler="$:/temp/appendbox"/>
>>>>> </$keyboard>
>>>>> </$vars>
>>>>>
>>>>> Since you are only appending on the Enter key as opposed to on every
>>>>> keystroke, you could indeed apply this code via a viewtemplate and append
>>>>> to the tiddler the textarea field is in, if so desired. The key is that 
>>>>> the
>>>>> edit-text widget writes to a temp tiddler.
>>>>>
>>>>>
>>>>> On Saturday, March 20, 2021 at 8:02:54 PM UTC+1 dieg...@gmail.com
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> Hello all,
>>>>>>
>>>>>> Using Nico's projectify with the excellent quick todo add, has put me
>>>>>> in mind for something similar.
>>>>>>
>>>>>> I'd like to have a tiddler with an edit box visible in view mode, and
>>>>>> when I type something in that edit box and press enter, what I've typed
>>>>>> gets *appended* to a tiddler (as I understand, cant be the tiddler
>>>>>> Im using the edit box in), with a timestamp.
>>>>>>
>>>>>> I know this will involve a keyboard widget. While I was trying it out
>>>>>> myself, I got stuck trying to append.
>>>>>>
>>>>>> Has anyone done anything similar and/or willing to help?
>>>>>>
>>>>>> Thanks!
>>>>>> Diego
>>>>>>
>>>>>>
>>>>>> --
>>>>> 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/a011af6d-89a5-4d90-bbf6-df25fc88f434n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/tiddlywiki/a011af6d-89a5-4d90-bbf6-df25fc88f434n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> 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/1f7d2e7b-c24a-4e19-8d3e-113fc6870e42n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tiddlywiki/1f7d2e7b-c24a-4e19-8d3e-113fc6870e42n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/42fde8cf-456c-4bf1-b08d-1a7231575180n%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/42fde8cf-456c-4bf1-b08d-1a7231575180n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMDhEqg1dUA80xHhSsgXPOuPg8ixFpQ5SJcVc1_7720Ncg%40mail.gmail.com.

Reply via email to