web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Computed Column in a view

(0) ShareShare
ReportReport
Posted on by

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.

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    239,140 Most Valuable Professional on at

    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.

  • Martin Dráb Profile Picture
    239,140 Most Valuable Professional on at

    Regarding the concatenation, the following discussion might help you: How to concatenate text from multiple rows into a single text string in SQL server?.

  • Verified answer
    Community Member Profile Picture
    on at

    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. 

    pastedimage1580171963855v1.png

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.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 689

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 258 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans