BAQ: Calculated Field Concatenate Rows to single field


(Brandon Anderson) #42

That’s what I did. I’m stumped.

select 
	[Summary].[PartBin_PartNum] as [PartBin_PartNum],
	[Summary].[Part_PartDescription] as [Part_PartDescription],
	[Summary].[Calculated_Qty] as [Calculated_Qty],
	(Replace(Replace(((select 
	(CAST(FilteredBins.PartBin2_BinNum AS VARCHAR) + ',') as [Calculated_Bins]
from  (select 
	[PartBin2].[PartNum] as [PartBin2_PartNum],
	[PartBin2].[BinNum] as [PartBin2_BinNum]
from Erp.PartBin as PartBin2
where (PartBin2.BinNum like '%402044'  or PartBin2.BinNum like '%402047'))  as FilteredBins
where FilteredBins. = Summary.PartBin_PartNum FOR XML PATH(''))) ,'</Calculated_Bins>',''),'<Calculated_Bins>','')) as [Calculated_Bins]
from  (select 
	[PartBin].[PartNum] as [PartBin_PartNum],
	[Part].[PartDescription] as [Part_PartDescription],
	(sum(PartBin.OnhandQty)) as [Calculated_Qty]
from Erp.PartBin as PartBin
inner join Erp.Part as Part on 
	PartBin.Company = Part.Company
	and PartBin.PartNum = Part.PartNum
group by [PartBin].[PartNum],
	[Part].[PartDescription])  as Summary

(Brandon Anderson) #43

Actually, it’s working. There were some missing filters so the nulls were valid. I re-added them, probably after being too click happy, and it’s working now. Thanks.