# Trouble Displaying Feedback for all blocks

**URL:** <https://discourse.psychopy.org/t/trouble-displaying-feedback-for-all-blocks/26867>\
**Category:** Builder\
**Created:** [January 17, 2022, 5:48pm UTC](https://discourse.psychopy.org/t/trouble-displaying-feedback-for-all-blocks/26867 "2022-01-17T17:48:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![erober69](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@erober69](https://discourse.psychopy.org/u/erober69)\
**Post date:** [January 17, 2022, 5:48pm UTC](https://discourse.psychopy.org/t/trouble-displaying-feedback-for-all-blocks/26867/1 "2022-01-17T17:48:59Z")

</div>

IIf this template helps then use it. If not then just delete and start from scratch.

**OS** (e.g. Win10): MacOS Catalina 10.15.7  
**PsychoPy version** (e.g. 1.84.x): 2021.2.3  
**Standard Standalone? (y/n)** If not then what?: Yes  
**What are you trying to achieve?:**

Greetings.

I am creating an experiment that features randomized trials in 4 trials blocks. The blocks are also randomized. I would like to provide feedback on the participant’s overall performance at the very end, with a percentage that shows the total number of trials (out of 60) that they got correct. My spreadsheets have a correctAnswer column that specifies the correct key response, and my keyboard response component is set to store last key data and use $correctAnswer for correct answer.

**What did you try to make it work?:**  
Following the instructions for the feedback at the end of a block on this page ([Builder - providing feedback — PsychoPy v1.84.0](https://psychopy.readthedocs.io/en/latest/recipes/builderFeedback.html)) using a feedback routine. Please see attached images. I include what the loops/routines look like in builder, the code I use for the feedback screen, and initially got a msg error. I removed the independent text component from the routine, and it now flashes a new error (see attached images for the code I am using and the experiment design in builder)

**What specifically went wrong when you tried that?:**

Draft\_lastrun.py", line 5753, in   
nCorr = block1trials.data[‘response.corr’].sum()  
NameError: name ‘block1trials’ is not defined

Although the instructions don’t specify to do so, I feel that I should probably be putting extra code somewhere in the trial block as well?

 ![ProcedureScreenShot1](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/4/a/4afc299342ad46bdc859eb16b708f3c5501b6dd7.jpeg)  
 ![ScreenShotCode2](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/1/f/1fced83cf7a6e4d6cbb05e5d191fd28a716f35de.jpeg)

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [January 18, 2022, 10:52am UTC](https://discourse.psychopy.org/t/trouble-displaying-feedback-for-all-blocks/26867/2 "2022-01-18T10:52:10Z")

</div>

Hello erober69

I never used block feedback before. But could it be that the code-line `nCorr = ...` is at the wrong place? Doesn’t it belong in the block1trials-routine and not in the Feedback-routine?

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![erober69](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@erober69](https://discourse.psychopy.org/u/erober69)\
**Post date:** [January 20, 2022, 3:09pm UTC](https://discourse.psychopy.org/t/trouble-displaying-feedback-for-all-blocks/26867/3 "2022-01-20T15:09:33Z")

</div>

Thanks! I was able to figure part of the problem out. response.corr was not labelled with the same name as what I had in my own experiment. It now displays!

However, it is only adding up the number of correct answers for the final repetition of the trial block. I need to get it to add up the cumulative total for all 4 repetitions.

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [January 21, 2022, 1:33pm UTC](https://discourse.psychopy.org/t/trouble-displaying-feedback-for-all-blocks/26867/4 "2022-01-21T13:33:07Z")

</div>

Hello erober69

do you reset the count somewhere? The variable must be initialized outside of your repetition loop, otherwise you reset it each repetition.

Best wishes Jens
