Announcements
No record found.
Hello,
I have a view and need to add a computed column to this view. The computed column is supposed to concatenate the values in different rows of a table to return a single string value. How can this be done? What is the method that I can write to achieve this?
Any help is much appreciated.
Regards
Hitesh.
Start by thinking about what T-SQL code is needed to obtain the value you want. Then you'll write a method on the view generating this code. Then you'll add a computed column linked to this method. On synchronization, the method will get called and T-SQL code it generates will be embedded with the with in database.
Regarding the concatenation, the following discussion might help you: How to concatenate text from multiple rows into a single text string in SQL server?.
Hi,
There are some good examples you can refer to views like SalesLineCube or SalesLineExpanded.
public static str salesCategoryCurrent() { return SysComputedColumn::currentItemProductCategory(tableStr(SalesLineExpanded), identifierStr(SalesLine), fieldStr(SalesLine, ItemId), fieldStr(SalesLine, SalesCategory), identifierStr(EcoResProductCategoryExpanded), fieldStr(EcoResProductCategoryExpanded, RecIdCategory)); }
for e.g If you want to know how a computed column is structured as Martin said above, you can go to SQL server management studio and browse down to a view (SalesLineExpanded) and script view as > Create to > New query window.you will the query which will show you the structure of the view and how the computed column is selected.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Giorgio Bonacorsi 689
André Arnaud de Cal... 478 Super User 2026 Season 1
Syed Haris Shah 258 Super User 2026 Season 1