From c9b6078fa88555a68d4ded82aaa7175c08bca726 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Mon, 11 Sep 2017 21:31:54 +0300 Subject: [PATCH] #ScriptEngine: The method setVariable() does not only change the value of the variable but also adds a new one if the variable does not exists --- limereport/lrscriptenginemanager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/limereport/lrscriptenginemanager.cpp b/limereport/lrscriptenginemanager.cpp index 6ee0689..0780951 100644 --- a/limereport/lrscriptenginemanager.cpp +++ b/limereport/lrscriptenginemanager.cpp @@ -1491,7 +1491,11 @@ QVariant ScriptFunctionsManager::currencyUSBasedFormat(QVariant value, const QSt void ScriptFunctionsManager::setVariable(const QString &name, QVariant value) { DataSourceManager* dm = scriptEngineManager()->dataManager(); - dm->changeVariable(name,value); + if (dm->containsVariable(name)){ + dm->changeVariable(name,value); + } else { + dm->addVariable(name, value, VarDesc::User); + } } QVariant ScriptFunctionsManager::getVariable(const QString &name)