On Monday, December 30, 2019 at 4:33:17 PM UTC-8, Dave wrote:
>
> I have this macro that sums up values from three different fields:
> \define vassum2(here mynow)
> VAS total: {{{[title[$here$]get[vashi.$mynow$]] [title[$here$]get[vaslo.
> $mynow$]] [title[$here$]get[disabil.$mynow$]] +[sum[]]}}}
> \end
>
> \define vassum()
> <$macrocall $name=vassum2 here="$(currentTiddler)$" mynow={{mynow!!my-now
> }} />
> \end
>
> <<vassum>>
> It works great as long as each of the three numbers is unique, but if for
> example the values are 8,3 and 3, then the total is presented as 11, not 14
> Is there a work-around for this?
>
Yes, there is. see https://tiddlywiki.com/#Dominant%20Append
By default, items in a list are "dominantly appended", which automatically
"de-duplicate" the results, so that individual items will appear only once
in the resulting list
Of course, as you have discovered, this is not appropriate when using math
operators. To work around this, you can use the "=" prefix in front of
each filter run, like this:
{{{ =[title[$here$]get[vashi.$mynow$]] =[title[$here$]get[vaslo.$mynow$]] =[
title[$here$]get[disabil.$mynow$]] +[sum[]] }}}
enjoy,
-e
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/fa53580f-ed2f-4ad6-9ed7-fe113a52d03b%40googlegroups.com.