I notice this issue hasn’t been properly documented yet. You’re correct in assuming setTrialData is close to what you need.
We have defined a three-level data system in the QRTEngine. The first is TrialData, which is stored and reset per-trial. A higher level is BlockData (QRTEngine.setBlockData(‘field’,value) and QRTEngine.getBlockData(‘field’) for data that persists through a block, but is reset upon encountering a new block. The last level is Survey Data (QRTEngine.setSurveyData(‘field’,value) and QRTEngine.getSurveyData(‘field’)) for survey wide data storage, which is basically a wrapper around the Qualtrics.SurveyEngine.setEmbeddedData functions.
It seems like you would need set and getBlockData for your survey.
Let me know if you can figure it out from here!