[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread TonyM
Diego, Evans solution is excelent and I would recommend for any calculation or logic heavy wiki. Here I was keen to find a light, native way to do something we often need to do in even simple wikis. I also wanted a solution closer to plan english, actualy those community member's which speak a

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread TonyM
Mark, Thanks for that, good addition to this simple method. It is so helpful for additional input from you, I did not stop to do this because I was building a more sophisticated macro or set of macros of The form If-field If-state If-var If field fieldname test If state tiddlername content If

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread Diego Mesa
Hey Tony and all, Great work and discussion! Very informative! I also came across Evans Condition Plugin: https://evanbalster.com/tiddlywiki/formulas.html#Condition%20Plugin which supports an <$if> <$else> widget On Sunday, July 8, 2018 at 9:18:56 PM UTC+2, Joshua Fontany wrote: > > Agreed,

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread Joshua Fontany
Agreed, very good design pattern, and excellent short-hand and applications. Mahalo (thanks)! -Joshua Fontany On Sunday, July 8, 2018 at 9:41:23 AM UTC-7, HansWobbe wrote: > > Tony: > > Quite a nice (and extensible) discovery! > > I find it's easy to get caught up in getting work done, with th

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread Mohammad
Great job! It works now! /Mohammad On Sunday, July 8, 2018 at 9:04:33 PM UTC+4:30, Mark S. wrote: > > You can make the definition more robust: > > \define if(fieldname test do) > <$list filter="[is[current]field:$fieldname$[$test$]]" variable="null"> > $do$ > > \end > > Now it will work with the

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread HansWobbe
Tony: Quite a nice (and extensible) discovery! I find it's easy to get caught up in getting work done, with the result that learning and understanding activities suffer. So posts like these are a nice way of being reminded that there is still lots of room for improvements. Thanks for shari

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread 'Mark S.' via TiddlyWiki
You can make the definition more robust: \define if(fieldname test do) <$list filter="[is[current]field:$fieldname$[$test$]]" variable="null"> $do$ \end Now it will work with the title field. -- Mark On Sunday, July 8, 2018 at 6:30:51 AM UTC-7, TonyM wrote: > > Mohammad, > > Testing the title

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread Mohammad
I thought to be used in a loop! But I got what is the problem now. /Mohammad On Sunday, July 8, 2018 at 6:00:51 PM UTC+4:30, TonyM wrote: > > Mohammad, > > Testing the title field is not possible because as I said > *any practical question answer pair when the fieldname is not a reserved > name

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread TonyM
Mohammad, Testing the title field is not possible because as I said *any practical question answer pair when the fieldname is not a reserved name like fields etc..* If you look at the filter operators you will notice [title[tiddlername]] so title is reserved (unfortunately) is a reserved [[t

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread Mohammad
Great Tony! Thank you On Sunday, July 8, 2018 at 5:54:30 PM UTC+4:30, TonyM wrote: > > Mohammad, > > Testing the title field is not possible because as I said > *any practical question answer pair when the fieldname is not a reserved > name like fields etc..* > > If you look at the filter operat

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread TonyM
Mohammad, Testing the title field is not possible because as I said *any practical question answer pair when the fieldname is not a reserved name like fields etc..* If you look at the filter operators you will notice [title[tiddlername]] so title is reserved (unfortunately) is a reserved [[t

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread Mohammad
Okay! So I have to use filed without quotes! /Mohammad On Sunday, July 8, 2018 at 5:27:43 PM UTC+4:30, TonyM wrote: > > Try > > > < Hello Tony! It works > """>> > > Tony > > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from thi

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread TonyM
Sorry, I think I answered you question as if it were in the other thread Cute Observation Add fields via simple text entry I will try and answer in relation to the if macro soon. Regards Tont -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To u

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread TonyM
Try <> Tony -- 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 post to this group, send email to tiddlywiki@googlegroup

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread Mohammad
Tony, I tried this: created: 20180708112046684 modified: 20180708112152816 tags: title: Test-If \define if(fieldname test do) <$list filter="[is[current]$fieldname$[$test$]]" variable="null"> $do$ \end <> But it returns Hello Tony! It works I expect nothing to be returned! -- You receiv

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread TonyM
Mohammad, Yes, I just tested it. It works, you export it with a new title field in the text, you import it it has the new name, however unless you delete the original tiddler it will remain. If you export as tid it only saves one file, I have not tested it with json tiddlers, I do not expect i

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread Mohammad
Tony! Great idea! Is it possible to use title as a filed? Is it possible to use this to rename tiddlers? For example if Tiddler A has filed:Tag = myTag Then rename Tiddler-A into Tiddler-Axxx /Mohammad On Sunday, July 8, 2018 at 12:59:44 PM UTC+4:30, TonyM wrote: > > Jed, > > Thanks for th

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread TonyM
Jed, Thanks for the feed back. I forgot to add of course the whole thing can be wrapped in a list field, to do for each items in a list. <$list filter="[prefix[$:/plugin]]"> <> The above also demonstrated the first and second field need not only be a field-name and value but can also be an

[tw5] Re: A Possibly very useful macro "if?

2018-07-08 Thread Jed Carty
That looks like very good shorthand for it. I use that same pattern very often in things I make and never really considered making a macro like that. It would probably make the code a lot easier to read. -- You received this message because you are subscribed to the Google Groups "TiddlyWiki"