Hi Mirko

That's a great question, and I guess there should be simpler solutions, but 
as far as I could see, this will work:
\define getScoreTiddler() $:/score/{{!!title}}

\define countScore()
<$action-deletetiddler $filter="[prefix[$:/temp]tag[ScoreTiddler]]"/>
<$list filter="[all[current]fields[]] -text -title" variable=F >
<$list filter="[all[current]get<F>match[correct]]" >
<$action-createtiddler $basetitle="$:/temp" tags="ScoreTiddler"/>
</$list>
</$list>
<$set name=c filter="[prefix[$:/temp]tag[ScoreTiddler]count[]]">
<$action-setfield $tiddler="$(scoreTiddler)$" text=<<c>> />
</$set>
\end

<$wikify name=scoreTiddler text=<<getScoreTiddler>> >
<$button actions=<<countScore>> >
Count score
</$button>

Score: <$transclude tiddler=<<scoreTiddler>> />

</$wikify>

It creates a temporary tiddler for each correct answer, then counts the 
tiddlers and assign the number to a new tiddler "$:/score/<title of 
question>" so that the score for each tiddler is saved seperately.


Best,
Anders

fredag 30. august 2019 11.03.32 UTC+2 skrev Mirko Richter følgende:
>
> Hi,
>
> is it possible to* count all fields* within some *single specific tiddler* 
> that have *a certain value*? If yes, how ;)? Im currently struggling on 
> that and don't know how to go on...
>
> (My use case: a filled-out questionnaire with the text "wrong" or 
> "correct" (i already calculate it while stepping the wizzard) in an 
> arbitrary number of fields. The field's name is the name of the underlying 
> question. I just want to know how many "wrong"s or "correct"s are in there.)
>
> *Additional question:* Can i also restricted the fields under 
> consideration in terms of regexp[], suffix[], prefix[] or other 
> string-based criteria?
>
> Thanks,
> Mirko
>

-- 
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/432d205c-19fe-4567-9d6d-c965f69be2cc%40googlegroups.com.

Reply via email to