I want to generate a simple filter that returns an average value. Example, I want to know the average age of all males (which are tiddlers tagged with person and male). I have macros to determine a single age. Fundamentally, the end filter that I am currently generating is correct.
Eg.
=62 =87 =5 +[average[]]
However, since I wrongly used a macro to return this string, it has embedded span tags and double quotes to my filter string, which causes the filter, when used, to return a wrong value.
The macro I wrote is somewhat complex. It has to filter out just male individuals, ensure that individual has a birth and death event (separate tiddlers), and use those to determine the age. Wrongly, I used various list and reveal widgets (this causes the span tags to appear in my result string) to determine if I can call my macro getAgeInYears.
I’m sure this is a common problem. Can someone point me to how this should be done? Obviously, I’m not looking for a solution to my exact problem. I suspect there is general way to code this type of problem.
Should I be appending these strings to a variable to generate my filter string? If so, how?
Thanks,
Craig