Ah I see - sorry I remember you mentioning that previously I should have gone back to look that up.
I'm still not sure why IF([]=[]) comes out false though. Thanks again for all your hard work Diego On Thursday, December 21, 2017 at 7:33:46 PM UTC-6, Evan Balster wrote: > > Hey, Diego — > > Currently boolean expressions use JavaScript's concept of "truthyness" > <https://developer.mozilla.org/en-US/docs/Glossary/Truthy> which is > rather messy and not necessarily ideal. > > Pending more sensible behavior in formulas, I recommend this: > > (= IF(count(*[**some-filter-that-grabs-the-fields]*) > 0, "<hr/>", "") > =) > > That <hr/> won't actually wikify to a horizontal rule in the current > plugin, but I expect to fix that in a new update tonight. > > > On Thursday, 21 December 2017 18:27:08 UTC-6, Diego Mesa wrote: >> >> Hey Evan, >> >> Is this expected: >> >> >> - IF([],'yes','no') >> - yes >> - IF([]=[],'yes','no') >> - no >> - IF([]='[]','yes','no') >> - no >> >> My motivation for testing this: I have several fields that if present, >> trigger a footer to be displayed preceded by <hr/> tag. Recently, Ive had >> tiddlers with two or more of these fields, leaving me with more than one >> <hr/> which is undesirable. I was thinking of using this plugin to solve >> that. >> >> On Thursday, December 21, 2017 at 2:38:47 PM UTC-6, Evan Balster wrote: >>> >>> Hey, Diego — >>> >>> Yes, that kind of logic is a ways off yet and would likely need to be >>> done with a for-loop like construct. >>> >>> For now, you'll need to construct it using the $list widget, like this; >>> >>> Recently modified: >>> <$list filter="[all[tiddlers]]"> >>> (= if(days(tw_date({{!!modified}}), now())<2, {{!!title}}&", ", "") =) >>> </$list> >>> >>> The fact that the output isn't wikified is pretty disadvantageous here, >>> as it means you add <br/>... >>> >>> On Thursday, 21 December 2017 14:24:23 UTC-6, Diego Mesa wrote: >>>> >>>> Thanks for this Evan! >>>> >>>> I was thinking of being able to use the if statement like this (in >>>> semi-pseduo code) >>>> >>>> IF( gt([all[tiddlers]get[modified]], add_days(date(now()),-5)), <<title >>>> >> + "has been recently modified") >>>> >>>> And that would display all tiddlers who were recently modified. But as >>>> I understand it, these arent really built to operate on arrays just yet - >>>> but might be in the future. >>>> >>>> Thanks again, >>>> Diego >>>> >>>> On Thursday, December 21, 2017 at 2:04:37 PM UTC-6, Evan Balster wrote: >>>>> >>>>> Hey, Diego — >>>>> >>>>> Using conditions to: >>>>> >>>>> - list / transclude >>>>> - Both of these are a bit difficult because formula results >>>>> aren't wikified right now. >>>>> - You could have a formula result in a filter or tiddler and >>>>> list or transclude that >>>>> - <$list filter=<<formula "if (insert condition here, >>>>> [tag[SomeTag]], [[mycondition is false]]">> > {{!!title}}... >>>>> </$list> >>>>> - use a macro >>>>> - Zero-argument macros can be used directly in formulas >>>>> - It's tougher for macros with arguments, until I add support >>>>> for those >>>>> - show some text >>>>> - (= if (insert condition here, "text to show when condition is >>>>> true", "") =) >>>>> - set a variable >>>>> - Set a variable based on a condition >>>>> - <$formula-vars varToSet="if (insert condition here, >>>>> "true-value", >>>>> "false-value")"> <<varToSet>>... </$formula-vars> >>>>> - set a field >>>>> - Changing fields will usually involve a $button widget and an >>>>> $action-setfield widget inside that whose arguments include >>>>> formulas. I >>>>> use this myself for auto-calculation of tiddler fields and might >>>>> make an >>>>> example of this later. >>>>> >>>>> >>>>> Here are a few examples doing some fancy calculations with the current >>>>> plugin: >>>>> >>>>> - Math & Tabulation >>>>> - >>>>> http://evanbalster.com/tiddlywiki/formulas.html#Demo%3A%20Tabulator >>>>> - Interactive SVG Visualizations >>>>> - >>>>> >>>>> http://evanbalster.com/tiddlywiki/explorables.html#Demo%3A%20Real%20Projective%20Line >>>>> - >>>>> >>>>> http://evanbalster.com/tiddlywiki/explorables.html#Demo%3A%20Harmonic%20Lattice >>>>> - >>>>> http://evanbalster.com/tiddlywiki/formulas.html#Demo%3A%20Starburst >>>>> >>>>> >>>>> On Thursday, 21 December 2017 13:46:57 UTC-6, Diego Mesa wrote: >>>>>> >>>>>> Hey Evan, >>>>>> >>>>>> Im more and more impressed with this plugin, the more I use it. If >>>>>> anyone has some time and has already come up with cool examples, can you >>>>>> share? Also, Im interested in answering each of Tony's points from his >>>>>> earlier question: >>>>>> >>>>>> Evan, >>>>>>> Please forgive my Ignorance; What can a and b be equal to in >>>>>>> Formulas' logical functions, like IF and IFS? >>>>>>> I am thinking if something evaluates to true how do I use this to >>>>>>> >>>>>>> - list >>>>>>> >>>>>>> >>>>>>> - transclude >>>>>>> >>>>>>> >>>>>>> - Use macro >>>>>>> >>>>>>> >>>>>>> - Show some text etc... >>>>>>> >>>>>>> >>>>>>> - Set a variable/field >>>>>>> >>>>>>> >>>>>>> I imagine there is a way to write a list filter if a formula it true >>>>>>> to show when true (or False) etc... >>>>>>> I expect knowing this may help the less sophisticated users (still >>>>>>> me at this point) make use of formula. >>>>>>> Thanks in Advance >>>>>>> Tony >>>>>> >>>>>> >>>>>> >>>>>> with specific examples. If anyone has any that would be great! >>>>>> >>>>>> Best, >>>>>> Diego >>>>>> >>>>>> >>>>>> >>>>>> On Wednesday, December 20, 2017 at 9:40:21 PM UTC-6, Evan Balster >>>>>> wrote: >>>>>>> >>>>>>> Hey, Tony — >>>>>>> >>>>>>> I'm aware of the ordinary "de-duplication" behavior. In this case, >>>>>>> it was happening even with filter operators that would normally allow >>>>>>> duplication, like "get". This was because of a poorly-implemented >>>>>>> optimization I'd written to reduce compilation overhead during filter >>>>>>> processing. Behavior is now consistent with typical filter operations. >>>>>>> >>>>>>> The unusual behavior of TiddlyWiki's "get" operator is pretty >>>>>>> important if you're doing something like summing up a bunch of >>>>>>> "quantity" >>>>>>> fields where many hold values like 1 or 2. >>>>>>> >>>>>>> On Wednesday, 20 December 2017 21:17:40 UTC-6, TonyM wrote: >>>>>>>> >>>>>>>> Evan, >>>>>>>> >>>>>>>> What you considered a Bug is a feature, because Titles are unique >>>>>>>> in TiddlyWiki so if you have two of the same name appear such as in >>>>>>>> when >>>>>>>> Tagged A, or B Or A and B we want the list of titles to be >>>>>>>> "de-duplicated", >>>>>>>> Of course when you use filters from non title sources we do not want >>>>>>>> this >>>>>>>> occurring. As you found. >>>>>>>> >>>>>>>> How did you address this? (details not necessary), I presume its >>>>>>>> only in formulae and not when you are filtering titles? >>>>>>>> >>>>>>>> Best wishes >>>>>>>> Tony >>>>>>>> >>>>>>>> On Thursday, 21 December 2017 14:05:37 UTC+11, Evan Balster wrote: >>>>>>>>> >>>>>>>>> *Formulas version 0.1.5*: >>>>>>>>> https://evanbalster.com/tiddlywiki/formulas.html >>>>>>>>> GitHub & issue tracking: >>>>>>>>> https://github.com/EvanBalster/TiddlyWikiFormula >>>>>>>>> >>>>>>>>> - Duplicate values in filters are now handled correctly. >>>>>>>>> >>>>>>>>> >>>>>>>>> On Wednesday, 20 December 2017 20:04:57 UTC-6, Evan Balster wrote: >>>>>>>>>> >>>>>>>>>> *General warning*: There is a bug in filter processing that >>>>>>>>>> prevents filters in formulas from returning duplicate values. This >>>>>>>>>> is >>>>>>>>>> likely to cause trouble with formulas like >>>>>>>>>> sum([tag[Expense]get[value]]) if >>>>>>>>>> two Expenses have the same value. >>>>>>>>>> >>>>>>>>>> This bug appears to have existed since the first release. >>>>>>>>>> >>>>>>>>>> I've got an incentive to fix this one quickly, so I might be >>>>>>>>>> patching this tonight. >>>>>>>>>> >>>>>>>>>> On Wednesday, 20 December 2017 19:53:59 UTC-6, Evan Balster wrote: >>>>>>>>>>> >>>>>>>>>>> Hey, TonyM — >>>>>>>>>>> >>>>>>>>>>> Are you formatting a lot of dates using the year/month/day >>>>>>>>>>> functions? If so, you'll probably have better luck with the text >>>>>>>>>>> conversion function T() and setting a dateFormat. See the >>>>>>>>>>> documentation >>>>>>>>>>> for the FormulaWidget for more information on date format strings >>>>>>>>>>> (which >>>>>>>>>>> use the same rules as in TiddlyWiki's settings). >>>>>>>>>>> >>>>>>>>>>> On Wednesday, 20 December 2017 19:31:53 UTC-6, TonyM wrote: >>>>>>>>>>>> >>>>>>>>>>>> Evan, >>>>>>>>>>>> >>>>>>>>>>>> Once again for you great work. I have started playing with the >>>>>>>>>>>> date related functions and finding it a little complex using Make >>>>>>>>>>>> a date from a TiddlyWiki timestamp and return. >>>>>>>>>>>> >>>>>>>>>>>> Is there any way to make this more direct or can you suggest a >>>>>>>>>>>> pattern to follow if all my dates are TiddlyWiki timestamps? >>>>>>>>>>>> >>>>>>>>>>>> PS I have many dates in one tiddler so it get unwieldy. >>>>>>>>>>>> >>>>>>>>>>>> Thanks in advance >>>>>>>>>>>> Tony >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> On Thursday, 21 December 2017 11:31:49 UTC+11, Evan Balster >>>>>>>>>>>> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>> *Formulas version 0.1.4*: >>>>>>>>>>>>> https://evanbalster.com/tiddlywiki/formulas.html >>>>>>>>>>>>> GitHub & issue tracking: >>>>>>>>>>>>> https://github.com/EvanBalster/TiddlyWikiFormula >>>>>>>>>>>>> >>>>>>>>>>>>> - Add text conversion functions: >>>>>>>>>>>>> - t, value, textjoin >>>>>>>>>>>>> - Add text utility functions: >>>>>>>>>>>>> - len, exact, mid, substitute, split, trim >>>>>>>>>>>>> - Add regular expression functions: >>>>>>>>>>>>> - regexreplace, regexmatch, regexextract, regexextract1. >>>>>>>>>>>>> - Add julian day / date conversion functions: >>>>>>>>>>>>> - julian, to_julian >>>>>>>>>>>>> - Fix off-by-one error in month function >>>>>>>>>>>>> - Fix error in if function, disable if function pending >>>>>>>>>>>>> support for more powerful function construction >>>>>>>>>>>>> - Fix errors in count and counta functions. >>>>>>>>>>>>> - Code cleanup >>>>>>>>>>>>> >>>>>>>>>>>>> New features are documented in the wiki. >>>>>>>>>>>>> >>>>>>>>>>>>> The strings and regex work were driven by my own needs with a >>>>>>>>>>>>> data archiving project. >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> On Wednesday, 20 December 2017 10:18:20 UTC-6, @TiddlyTweeter >>>>>>>>>>>>> wrote: >>>>>>>>>>>>>> >>>>>>>>>>>>>> Dear Evan >>>>>>>>>>>>>> >>>>>>>>>>>>>> Thank you for adding that simple demo. It really helped me >>>>>>>>>>>>>> better understand how to use the plugin and make steps towards >>>>>>>>>>>>>> what I need!! >>>>>>>>>>>>>> >>>>>>>>>>>>>> Best wishes >>>>>>>>>>>>>> Josiah >>>>>>>>>>>>>> >>>>>>>>>>>>>> Evan Balster wrote: >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> Released version 0.1.2: >>>>>>>>>>>>>>> http://evanbalster.com/tiddlywiki/formulas.html >>>>>>>>>>>>>>> ... >>>>>>>>>>>>>>> * Added badger inoculation simulator >>>>>>>>>>>>>>> <http://evanbalster.com/tiddlywiki/formulas.html#Demo%3A%20Tabulator> >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> for @TiddlyTweeter (still lacks month automation, though) >>>>>>>>>>>>>>> >>>>>>>>>>>>>> -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/8679b00b-0185-4ae5-980d-78de98a9530b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

