Dynamic Item Description Based on Attributes - Derived Property, FOR XML PATH not working -- help?

Greetings!

I am attempting to create a derived field in CSI SLItems that will generate a custom Item description dynamically, based on Item Attributes. Because multiple attributes can exist per Item, I am needing to get columns from multiple rows and flatten them to fit in one row, space delimited.

However, the code below is yielding 'Incorrect syntax near the keyword 'NULL'. Any assistance would be greatly appreciated!! Workaround also welcome. Thank you!

(SELECT
STUFF(
(SELECT ' ' + AttributeValue
FROM AttributeValueView avv
WHERE avv.RefRowPointer = RowPointer AND avv.AttributeValue IS NOT NULL
FOR XML PATH(''), TYPE).value('(./text())[1]', 'nvarchar(max)'),1,1,''))

Parents Reply Children
  • It would be more helpful to know the logic behind the selection - which attributes or specific attribute, key ID(s) associated with those attributes, etc. - to help guide you in how to configure the derived property. I would also advise creating the solution as an IDO Extension Class (.NET Code) and not SQL, as stored procedures are deprecated in future versions of CSI. Depending on the complexity of your logic, it may be able to be done directly in the implementation of the derived property though.