OBJECT Query 55500 Distribution Orders { OBJECT-PROPERTIES { Date=16.09.16; Time=12:35:31; Modified=Yes; Version List=; } PROPERTIES { CaptionML=[DEU=Verteilerauftr„ge; ENU=Distribution Orders]; } ELEMENTS { { 1112000000;;DataItem; ; DataItemTable=Table36; DataItemTableFilter=Document Type=CONST(Order), Sales Promotion No.=FILTER(<>'') } { 1112000002;1;Column;SalesPromotionNo_SalesHeader; DataSource=Sales Promotion No. } { 1112000001;1;Column;NoOfOrders ; MethodType=Totals; Method=Count } { 1112000004;1;DataItem; ; DataItemTable=Table7320; DataItemLink=Sales Promotion No.=Sales_Header."Sales Promotion No." } { 1112000003;2;Column;SalesPromotionNo_WhseShptHdr; DataSource=Sales Promotion No. } { 1112000005;2;Column;NoOfWhseShpts ; MethodType=Totals; Method=Count } } CODE { BEGIN { } END. } }
Answers
An alternative solution would be to add a FlowField on your Sales Header that counts the number of Warehouse Shipments with the same Sales Promotion No.
Then in your query you only have the Sales Header DataItem and the columns Sales Promotion No., the newly created FlowField and your count column. Because the count of the FlowField will be the same for each unique Sales Promotion No. you will get the right values from your query.
I didn't know the COUNT behaviour in the querys.
Now I created a new FlowField and everything works fine.