RE: Line item Comment in Smart list
Okay, we are clear now. Consider the script below which will retrieve all line item comments. SOP numbers with no line item comments won't be retrieved.
- [SOP10202] Sales Line comments work and history
- [SOP10200] Sales Transactions Amounts Work
- [SOP30300] Sales Transactions Amounts History
SELECT SOP_Number ,
Status ,
ITEMNMBR ,
ITEMDESC,
COMMENT_1 ,
COMMENT_2 ,
COMMENT_3 ,
COMMENT_4 ,
Comment_Text
FROM ( SELECT SOPNUMBE AS SOP_Number ,
LNITMSEQ ,
CASE SOPTYPE
WHEN 1 THEN 'Quote'
WHEN 2 THEN 'Order'
WHEN 3 THEN 'Invoice'
WHEN 4 THEN 'Return'
WHEN 5 THEN 'Back Order'
WHEN 6 THEN 'Fulfillment Order'
END AS SOP_Document_Tyoe ,
COMMENT_1 ,
COMMENT_2 ,
COMMENT_3 ,
COMMENT_4 ,
CMMTTEXT Comment_Text
FROM [SOP10202]
) AS A
LEFT OUTER JOIN ( SELECT 'Work' AS Status ,
SOPNUMBE ,
LNITMSEQ ,
ITEMNMBR ,
ITEMDESC
FROM SOP10200
UNION ALL
SELECT 'History' AS Status ,
SOPNUMBE ,
LNITMSEQ ,
ITEMNMBR ,
ITEMDESC
FROM SOP30300
) AS B ON A.SOP_Number = B.SOPNUMBE
AND A.LNITMSEQ = B.LNITMSEQ
Here is the data set of the result:
You may create a view for the script above and get it published on Dynamics GP through Smartlist designer or builder.
Let me know if you have any further inquiries,