Hi,
I decided to write the query in Fetch Method of Report. So I tried to make a job to test the code.
The problem now is, that while infolog returns the correct result set, I cannot pass correctly the queryrun as argument to class oReportManager*.createBalanceListTmp* . All records from MainAccount are passed and not olny the ones I have selected according to report criteria when I run it. (For example I select one MainAccount and specific Dimensions)
Code is below. Can you please help me?
static void LedgerBalance(Args _args)
{
Query query;
QueryRun queryrun;
QueryBuildDataSource qbds1;
QueryBuildDataSource qbds2;
QueryBuildRange qbr1;
QueryBuildRange qbr2;
LedgerTransView tLedgerTrans;
MainAccount tmainAccount;
GeneralJournalAccountEntry accEntry;
TmpBalanceList m_tTransactions;
ReportManager oReportManager ;
;
oReportManager = new ReportManager ();
query = new query();
qbds1 = query.addDataSource(tablenum(MainAccount));
qbds2 = qbds1.addDataSource(tableNum(LedgerTransView));
qbds2.relations(false);
qbds2.joinMode(joinmode::OuterJoin);
queryrun = new queryrun(query);
if (queryrun.prompt() )
{
while(queryrun.next() )
{
tLedgerTrans = queryrun.get(tablenum(LedgerTransView));
tmainAccount= queryrun.get(tablenum(MainAccount));
oReportManager .createBalanceListTmp (queryrun,
m_tTransactions,
2,
BalanceTransListType::LedgerAccount,
“EUR”,
NoYes::No,
-1,
0,
NoYes::Yes,
-1,
NoYes::No,
NoYes::No,
NoYes::No,
NoYes::No,
NoYes::No,
NoYes::No,
NoYes::No);
info(strfmt("%1 – %2", DimensionAttributeValueCombination::find(tLedgerTrans.LedgerDimension).DisplayValue, tLedgerTrans.LedgerDimension));
}
}
}