01.09.2015, 17:16 | #1 |
Участник
|
SQL в QueryBuildDataSource
Доброго времени суток!
Пытаюсь разобраться с Query и QueryBuildDataSource в Х++. Есть SQL запрос такого вида: PHP код:
PHP код:
Вот мой код X++: Query q; QueryBuildDataSource qbMA; QueryBuildDataSource qbDAVC; QueryBuildDataSource qbDH; QueryBuildDataSource qbDHL; QueryBuildDataSource qbDA; q = new Query(); qbMA = q.addDataSource(tablenum(MainAccount)); qbMA.relations(false); qbDAVC = qbMA.addDataSource(tablenum(DimensionAttributeValueCombination)); qbDAVC.relations(false); qbDAVC.addLink(fieldNum(DimensionAttributeValueCombination,MainAccount),fieldNum(MainAccount,RecId)); qbDAVC.joinMode(JoinMode::InnerJoin); qbDH = qbDAVC.addDataSource(tablenum(DimensionHierarchy)); qbDH.relations(false); qbDH.addLink(fieldNum(DimensionHierarchy,RecId),fieldNum(DimensionAttributeValueCombination,AccountStructure)); qbDH.joinMode(JoinMode::InnerJoin); qbDHL = qbDH.addDataSource(tablenum(DimensionHierarchyLevel)); qbDHL.relations(false); qbDHL.addLink(fieldNum(DimensionHierarchyLevel,DimensionHierarchy),fieldNum(DimensionHierarchy,RecId)); qbDHL.joinMode(JoinMode::InnerJoin); qbDA = qbDHL.addDataSource(tablenum(DimensionAttribute)); qbDA.relations(false); qbDA.addLink(fieldNum(DimensionAttribute,RecId),fieldNum(DimensionHierarchyLevel,DimensionAttribute)); qbDA.joinMode(JoinMode::InnerJoin); |
|
|
|