I just don't have enough information here, but let me explain the change from the 'where' clause to the 'and' in the 'from' clause. If you make a selection on a table that is left joined, i.e., using a where clause that references the right hand table, it effectively "undoes" the left join. If instead you build the selection into the from clause by requiring the selection in the link, the left join is maintained, and you will only get records from the right hand table that meet the criterion.
I don't follow the logic of the what you were trying to do with your original approach. I guess you could try:
left join SHIPPING_CONTAINER sc on
sd.internal_shipment_line_num = sc.internal_shipment_line_num and
sc.internal_shipment_num = @INTERNAL_SHIPMENT_NUM
I didn't notice how you changed my original suggestion, but yes, you implemented it incorrectly. Try this:
whileprintingrecords;
stringvar notshipped;
if {shipment_detail.TOTAL_QTY} = 0 then
notshipped := notshipped & " " & {Shipment_Detail.item} & " " & {Shipment_Detail.customer_item}& " " & {Shipment_Detail.item_desc} & " " &totext({Shipment_Detail.REQUESTED_QTY},0) & chr(13);
if {Shipment_Detail.TOTAL_QTY} < {Shipment_Detail.REQUESTED_QTY} then
notshipped := notshipped & " " & {Shipment_Detail.item} & " " & {Shipment_Detail.customer_item}& " " & {Shipment_Detail.item_desc} & " " & totext({Shipment_Detail.REQUESTED_QTY} - {Shipment_Detail.TOTAL_QTY},0) & chr(13) else
notshipped:= notshipped;
-LB