From 20d70d05655be7658592d4e38873b872fcb78d91 Mon Sep 17 00:00:00 2001
From: Magne Sjaastad <magne.sjaastad@ceetronsolutions.com>
Date: Tue, 12 Aug 2014 10:54:46 +0200
Subject: [PATCH] Bugfix statistics: Trigger loading of dataset before creating
 a result accessor

---
 .../ProjectDataModel/RimStatisticsCaseEvaluator.cpp            | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ApplicationCode/ProjectDataModel/RimStatisticsCaseEvaluator.cpp b/ApplicationCode/ProjectDataModel/RimStatisticsCaseEvaluator.cpp
index 778b4d19c0..66b6f25a30 100644
--- a/ApplicationCode/ProjectDataModel/RimStatisticsCaseEvaluator.cpp
+++ b/ApplicationCode/ProjectDataModel/RimStatisticsCaseEvaluator.cpp
@@ -196,6 +196,9 @@ void RimStatisticsCaseEvaluator::evaluateForResults(const QList<ResSpec>& result
                 {
                     RimCase* sourceCase = m_sourceCases.at(caseIdx);
 
+					// Trigger loading of dataset
+					sourceCase->results(poroModel)->findOrLoadScalarResultForTimeStep(resultType, resultName, dataAccessTimeStepIndex);
+
 					cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(sourceCase->reservoirData(), gridIdx, poroModel, dataAccessTimeStepIndex, resultName, resultType);
                     if (resultAccessor.notNull())
                     {