Group functions fixed for qtscriptengine

This commit is contained in:
Arin Alexander 2018-04-12 22:41:34 +03:00
parent c2d731eef9
commit 537fec13fd
2 changed files with 8 additions and 2 deletions

View File

@ -346,8 +346,8 @@ void ScriptEngineManager::setDataManager(DataSourceManager *dataManager){
LimeReport::Const::FUNCTION_MANAGER_NAME,
m_functionManager,
QString("function %1(fieldName, bandName, pageitem){\
pageitem = typeof pageitem !== 'undefined' ? pageitem : 0; \
return %2.calcGroupFunction(\"%1\",fieldName, bandName, pageitem);}"
if (typeof pageitem == 'undefined') return %2.calcGroupFunction(\"%1\", fieldName, bandName); \
else return %2.calcGroupFunction(\"%1\", fieldName, bandName, pageitem);}"
).arg(func)
.arg(LimeReport::Const::FUNCTION_MANAGER_NAME)
);
@ -1471,6 +1471,11 @@ QVariant ScriptFunctionsManager::calcGroupFunction(const QString &name, const QS
}
}
QVariant ScriptFunctionsManager::calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName)
{
return calcGroupFunction(name, expressionID, bandName, 0);
}
QVariant ScriptFunctionsManager::line(const QString &bandName)
{
QString varName = QLatin1String("line_")+bandName.toLower();

View File

@ -307,6 +307,7 @@ public:
foreach(IWrapperCreator* wrapper, m_wrappersFactory.values()){ delete wrapper;} m_wrappersFactory.clear();
}
Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName, QObject* currentPage);
Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName);
Q_INVOKABLE QVariant line(const QString& bandName);
Q_INVOKABLE QVariant numberFormat(QVariant value, const char &format, int precision, const QString &locale);
Q_INVOKABLE QVariant dateFormat(QVariant value, const QString& format);