Indexe based location to increment

Requires initialisation

<$button>
<$list filter="[{$:/config/incremental/indexes##A}is[blank]]" variable=nul>
  <$action-setfield $tiddler="$:/config/incremental/indexes" $index="A" 
$value="0"/>
</$list>
<$action-setfield $tiddler="$:/config/incremental/indexes" $index="A" 
$value={{{ [[$:/config/incremental/indexes]getindex[A]add[1]] }}}/>
Add 1 to {{$:/config/incremental/indexes##A}}
</$button>


$:/config/incremental/indexes {{$:/config/incremental/indexes##A}}


<$set name=currentN value={{{ [[$:/config/incremental/indexes]getindex[A]] 
}}} >


currentN=<<currentN>>


</$set>


Regards
Tony/TW Tones

On Thursday, 10 September 2020 17:13:12 UTC+10, TW Tones wrote:
>
> Bob, a little more
>
>    - If you are doing this to develop a unique ID I have done 
>    considerable work on what I call a tiddler Serial number, so do ask.
>    - The new tiddler process done the correct way, will also increment a 
>    tiddler title if the current title exists.
>    - It is possible to do this in a field other than text.
>    - If you want to increment a number from a filter you can use the 
>    range operator as well.
>    - You could save into and retrieve such a value from a data tiddler as 
>    well.
>
> Regards
> Tony
>
>
> On Thursday, 10 September 2020 17:07:44 UTC+10, TW Tones wrote:
>>
>> Bob,
>>
>> I meant to say I live and work in Randwick.
>>
>> Place this in a new tiddler and click add 1
>>
>> <$button>
>> <$action-setfield $tiddler="$:/config/incremental" text={{{ 
>> [{$:/config/incremental}add[1]] }}}/>
>> Add 1
>> </$button>
>>
>> $:/config/incremental {{$:/config/incremental}}
>>
>> <$set name=currentN value={{$:/config/incremental}}>
>>
>> currentN=<<currentN>>
>>
>> </$set>
>> This works, ever to initialise the first value
>>
>> The set demonstrates how to make it a variable.
>>
>> I advise on keeping code separate from values.
>>
>> On Thursday, 10 September 2020 16:54:06 UTC+10, Bob Jansen wrote:
>>>
>>> am I correct in my thinking that I can consider a tiddler like an object 
>>> in an OO database having data stored in fields and functions stored as 
>>> macros in the text field? 
>>>
>>> In my case, if I had a tiddler, say $:/tls/unique-id with a field 
>>> unique_id having a value of 1. I could then write a macro in that tiddler, 
>>> say increment_unique_id,  to increment the field by 1 and use a $list 
>>> filter to retrieve the new number from any other tiddler that needs the 
>>> unique value. To increment, all I need to do is call the macro that 
>>> increments the number in the tiddler $:/tls/unique-id.
>>>
>>> Am I on the wrong track here?
>>>
>>> bobj
>>>
>>> On Thursday, 10 September 2020 at 16:00:18 UTC+10 Bob Jansen wrote:
>>>
>>>> Tones,
>>>>
>>>> Thanks for your reply. I am not averse to learning about filters in 
>>>> fact as I go along I'm getting much better at them. 
>>>>
>>>> I was just frustrated at the poor documentation of how to do simple 
>>>> concatenation or arithmetic. The examples assume a higher level of 
>>>> familiarity with the subject than I currently possess. The issue for me is 
>>>> how to relate my problem to a filter based solution.
>>>>
>>>> Hopefully your reply as with others will give me greater insight.
>>>>
>>>> Bobj
>>>>
>>>> ---------------
>>>>
>>>> Dr Bob Jansen
>>>>
>>>> The Cultural Conversations project 
>>>>
>>>> Turtle Lane Studios Pty Ltd trading as the Australian Centre for Oral 
>>>> History
>>>>
>>>> 122 Cameron St, Rockdale NSW 2216, Australia 
>>>>
>>>> Ph (Korea): +82 10-4494-0328 
>>>>
>>>> Ph (Australia) +61 414 297 448 
>>>>
>>>> Resume: http://au.linkedin.com/in/bobjan 
>>>>
>>>> Skype: bobjtls 
>>>>
>>>> KakaoTalk: bobjtls 
>>>>
>>>> http://www.cultconv.com 
>>>>
>>>>
>>>>  In line with the Australian anti-spam legislation, if you wish to receive 
>>>> no further email from me, please send me an email with the subject "No 
>>>> Spam"
>>>>
>>>>
>>>> On 10 Sep 2020, at 12:19, TW Tones <anthony...@gmail.com> wrote:
>>>>
>>>> Bob,
>>>>
>>>> 1. Is there a simple concatenation operator, like & or + that can be 
>>>>> used to concatenate strings? I know that a macro can do it but that seems 
>>>>> very confusing to a simple mind like me.
>>>>
>>>>
>>>> 1. Concatenation
>>>>
>>>> There are many ways to concatenate with tiddlywiki, although for good 
>>>> reasons in may seem not as strait forward as you would expect. In part 
>>>> because where do you want this concatenated result used?
>>>> Please provide a descriptive  example of what you are currently try to 
>>>> achieve.
>>>>
>>>> With concatenation you will find these methods useful
>>>>
>>>>    - Define a macro in which the concatenation occurs
>>>>       - You can use $(currentTiddler)$ and parameter $param$ for 
>>>>       simple substitutions
>>>>    - Wiki fy that macro (with the same name is ok) just before you use 
>>>>    it say in a filter and some parameters
>>>>    - You can use add-prefix/split/join/splitregext and other string 
>>>>    handling.
>>>>
>>>> 2. Is there a way of doing simple arithmetic, say increment a variable 
>>>>> or add some variables together? The manual implies that it is possible in 
>>>>> a 
>>>>> filter but I want to do it outside of a filter.
>>>>
>>>>
>>>> 2. Most if not all the mathematics functions in standard tiddlywiki are 
>>>> "filter operators", so they must be used in filters
>>>>
>>>> However;
>>>>
>>>>    - Use triple braces to present the result of a calculation in line 
>>>>    as a parameter.
>>>>    {{{ [your maths filter] }}} but you may need to turn the result 
>>>>    into text <$text text={{{ [your maths filter] }}}/>
>>>>    - You can use other maths plugins like Evans formula plugin he uses 
>>>>    Mushroom brackets (= maths =), calc widget and others
>>>>
>>>> In closing if you are reluctant to learn filters in more detail, I 
>>>> suggest you jump in. Filters are so powerful once you come to understand 
>>>> them your powers are almost unlimited.
>>>>
>>>> Regards
>>>> TW Tones
>>>>
>>>> On Thursday, 10 September 2020 11:13:06 UTC+10, Bob Jansen wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> bobj
>>>>>
>>>>> -- 
>>>> You received this message because you are subscribed to a topic in the 
>>>> Google Groups "TiddlyWiki" group.
>>>> To unsubscribe from this topic, visit 
>>>> https://groups.google.com/d/topic/tiddlywiki/WFwExRhO05c/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to 
>>>> tiddlywiki+...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/tiddlywiki/7ff64fd3-d473-4ecb-b463-818671f80e51o%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/tiddlywiki/7ff64fd3-d473-4ecb-b463-818671f80e51o%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/0a558ada-caf7-4115-b4ea-bf71faa0b489o%40googlegroups.com.

Reply via email to