Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
Is there an easy way to use something like 'SELECT STUFF ... FOR XML PATH' in SQL?
I'm trying to create a table with title like this:
Analysis for: 2014 (when one year is selected)
Analysis for: 2012, 2013, 2014 (when more than one year is selected).
I need a function that puts all selected values (ike Year in this example) and a comma between them. My current expression is:
='Analysis for: ' & Only(Year) (because I only know how to put only one value).
Can you help me?
Thanks a lot!
Use the concat function like:
='Analysis for: ' & concat(distinct Year, ',')
Or you could also use GetFieldSelections(Year)
Hope this helps!
Use the concat function like:
='Analysis for: ' & concat(distinct Year, ',')
Or you could also use GetFieldSelections(Year)
Hope this helps!
i agree with jerem1234´s solution
concat writes every item in the selected field (Year) after each other.
here, the function distinct is added, to prevent redundancy (2013, 2013, 2014).
The last option is the separator, which is entered between the field contents
concat(distinct Year, ',')
i would suggest to ad another space to the seperator
concat(distinct Year, ' ,')
This certainly helps, I combined this solution with GetSelectedCount() to avoid putting all values in title when nothing is selected.
Thanks a lot for your swift answer!
Best regards,
Pawel