Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-07 Thread Tobias Beer
Hi Antaeus, There's are these core functions: *parseDate* — parses a datestring into a js date object *stringifyDate* — does the reverse So, something like this should do the trick of shifting by a given number of days... function(datestring, shiftbydays) { var date =

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-07 Thread 'Mark S.' via TiddlyWiki
That code looks nice and clean, and might do everything Antaeus wants ... EXCEPT that it can't (or at least I don't think it can) be used inside a button the way he wants. The solution is to rewrite the javascript code so that it accepts values from <$set> variables outside instead of

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-06 Thread infurnoape
How about  http://t5a.tiddlyspot.com/#%24%3A%2Fplugin%2Fajh%2Ftiddlytime%2FDateTime.js Happy Connecting. Sent from my Sprint Samsung Galaxy S® 5 Original message From: Antaeus Feldspar Date: 10/06/2015 7:13 PM (GMT-07:00) To: TiddlyWiki

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-06 Thread Antaeus Feldspar
I absolutely plan to offer it for public consumption when I have it working well. I also have some ideas for some useful filter-operators, but since I'm just getting started with the macros, the filter-operators are some distance in the future! -- You received this message because you are

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-06 Thread Antaeus Feldspar
Actually, perhaps I should share what my macro will do - I went looking to see if there was an existing plugin that handled such things, and didn't find one, but that could be just because I wasn't looking in the right places. My macro will take a 17-character string as used in a Date field as

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-06 Thread Tobias Beer
Hi Antaeus, Tobias, you're right that the best solution may end up being something > other than a macro, but to keep the project going, I have a deep need to be > able to update certain data fields easily in great numbers of tiddlers. An > imperfect solution now is tons better than a perfect

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-04 Thread Jeremy Ruston
Hi Mark As you’ve discovered, this doesn’t work: <> Instead, you can use the <$macrocall> widget to invoke the macro. For example: <$macrocall $name=“textMaker” myParam={{!!myField}}/> Widgets are the fundamental unit of functionality in TiddlyWiki; all the other wikitext syntax is just

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-04 Thread Jeremy Ruston
Hi Antaeus > Jeremy, could I please get your answer to my question? I would have expected Tobias’s solution to work. Does it work for you? > What is the right way to create a button that will read a value from a field, > use that value as input to a macro to reach a new value, and then write

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-04 Thread Tobias Beer
Hi Antaeus, I can see how a js macro might be a simpler first step but perhaps a macro isn't the best implementation for what it is you try to achieve, but rather a widget or maybe a filter operator. Best wishes, — tb -- You received this message because you are subscribed to the Google

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-04 Thread Antaeus Feldspar
Jeremy, could I please get your answer to my question? What is the right way to create a button that will read a value from a field, use that value as input to a macro to reach a new value, and then write that value back to the same field? I'm starting to get a bit discouraged that such a

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-04 Thread Antaeus Feldspar
Thank you, Jeremy and Tobias especially! I have it working now! The first time I read Tobias' solution and tried my own based on it, it didn't work for me. I don't know exactly what I was doing wrong (the text of that attempt was lost by a browser crash), but every attempt to call the macro

[tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-03 Thread Antaeus Feldspar
Or, to express it a different way from the subject line, how can I create a button widget that will: a) take the current value of a tiddler field; b) use that current value as a parameter to a macro to calculate a new value; and c) put that new value back into the tiddler field that was read?

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-03 Thread Jeremy Ruston
Hi Mark > 3) You can use a macro inside a widget IF it doesn't have a parameter That is not correct. Macro invocations used as widget attributes may have parameters. However, there are a couple of points to watch: * The output of the macro is not wikified; it is used directly as the value of

Re: [tw] [TW5] How to create a button that replaces a field value based on the current field value?

2015-10-03 Thread 'Mark S.' via TiddlyWiki
Hi Jeremy, But, at the bottom line, is there any way to set up Tobias' solution without resorting to <$set> (or <$var>) ? Thanks! Mark On Saturday, October 3, 2015 at 3:31:53 PM UTC-7, Jeremy Ruston wrote: > > Hi Mark > > 3) You can use a macro inside a widget IF it doesn't have a parameter >