I’m creating a BAQ for quality assurance. One of the fields that they are requesting is the DMR reason code. Instead of just showing the id of the reason code they want to see the description.
I can do a String_AGG to concatenate the values into one field, but I’m having a problem doing that when I do a case statement to get the description for the field instead of just the id.
STRING_AGG(
CASE
WHEN DMRAct.DMRActn1_ReasonCode = 'DNF' THEN 'Does not function'
WHEN DMRAct.DMRActn1_ReasonCode = 'Spec' THEN 'Does not meet specifications'
WHEN DMRAct.DMRActn1_ReasonCode = 'Failed' THEN 'Failed FAI/PPAP'
WHEN DMRAct.DMRActn1_ReasonCode = 'HD' THEN 'Handling damage'
WHEN DMRAct.DMRActn1_ReasonCode = 'IncPkg' THEN 'Incorrect packaging'
WHEN DMRAct.DMRActn1_ReasonCode = 'Plbl' THEN 'Parts labeled/ID incorrect'
WHEN DMRAct.DMRActn1_ReasonCode = 'ShipTran' THEN 'Shipping/Transit Damage'
WHEN DMRAct.DMRActn1_ReasonCode = 'WrgPrt' THEN 'Wrong Part'
WHEN DMRAct.DMRActn1_ReasonCode = 'BulkInsp' THEN 'Bulk Inspection'
END,
', '
) AS ReasonDescriptions
Its throwing an incorrect syntax error.
