ren_bsi
27th December 2017, 14:18
Dear Gurus,

I'm trying to do Data Grouping in a customized print session as follow :

Item General Table :

Item Material
---------------------
A VCN
B KNL
C VCN

Expected Data Grouping result :

Materials : VCN KNL

I do have the following script in the report script :


before.curr.shpm.10:
before.layout:
select whinh431.item
from whinh431
where whinh431.shpm = {:curr.shpm}
selectdo
select tcibd001.dscd:b.dscd
from tcibd001
where tcibd001.item = {:whinh431.item}
group by tcibd001.dscd
selectdo
desc.dscd = desc.dscd & trim$(b.dscd)
endselect
endselect


but the Data Grouping is not working and the result is : VCN KNL VCN which is incorrect.
Kindly need your advice.
Thanks in advance. :)

Best regards,
Rendy

vahdani
29th December 2017, 11:18
Hallo Rendy,

you cannot use group by if your select brings only one result. Use the following select. It selects the material for all items in shipment and then groups all these materials:

before.curr.shpm.10:
before.layout:
select tcibd001.dscd:b.dscd
from whinh431,
tcibd001
where whinh431.shpm = {:curr.shpm}
and tcibd001.item = whinh431.item
group by tcibd001.dscd
selectdo
desc.dscd = desc.dscd & trim$(b.dscd)
endselect

And Happy new year!

ren_bsi
2nd January 2018, 07:25
Dear Vahdani,

It works perfectly.
Thank you so much for your kind help :)

Best regards,
Rendy