I am joining GeneralJournalEntry
and GeneralJournalAccountEntry
in the first part of my query. I am hard coding the MainAccount
for now as i am not sure on how to properly use DimensionProvider
class.
query = new Query();
qbdsGeneralJournalAccountEntry = query.addDataSource(tableNum(GeneralJournalAccountEntry));
qbr1 = qbdsGeneralJournalAccountEntry.addRange(fieldNum(GeneralJournalAccountEntry, LedgerAccount));
qbr1.value(queryValue('111111') + '*');
qbdsGeneralJournalEntry = qbdsGeneralJournalAccountEntry.addDataSource(tableNum(GeneralJournalEntry));
qbdsGeneralJournalEntry.relations(true);
qbdsGeneralJournalEntry.joinMode(JoinMode::InnerJoin);
if (_fromDate || _toDate)
{
qbdsGeneralJournalEntry.addRange(fieldnum(GeneralJournalEntry, AccountingDate)).value(queryRange(_fromDate, _toDate));
qbdsGeneralJournalEntry.addSortIndex(indexNum(GeneralJournalEntry, LedgerAccountingDateIdx));
qbdsGeneralJournalEntry.indexIsHint(true);
}
dimensionProvider = new DimensionProvider();
dimensionProvider.addAttributeRangeToQuery(
query
, qbdsGeneralJournalAccountEntry.name()
, fieldStr(GeneralJournalAccountEntr, LedgerDimension)
, DimensionComponent::DimensionAttribute
, _costCenterNumber
, "CostCenter");
All my lines are being duplicated.. i think i am adding the GeneralJournalAccountEntry
datasource again and that's why i have this behavior.
I can check the cost center value inside the while qr.next section but.. is there a way to do it right using the above method: addAttributeRangeToQuery
?