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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to concatenate two fields data into one fields in query in D365FO

(1) ShareShare
ReportReport
Posted on by 230
Hi Team,
 
I am having two table.
TableA and TableB
 
TableA i am having 2 fields
Field1
Field2
 
TableB i am having 1 field
FieldZ
 
Below should be the output
TableB.FieldZ = TableA.Field1 + TableA.Field2
 
Below code i am using.
 qbdsTableA = query.addDataSource(tableNum(TableA));

 qbdsTableB = qbdsTableA.addDataSource(tableNum(TableB));
 qbdsTableB.addLink(fieldNum(TableA, Field1), fieldNum(TableB, FieldZ));
 
Please let me know how to achieve this.
Categories:
I have the same question (0)
  • Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi,
     
    Do you want to set the FieldZ on Form? or do you want to query already existing data on the form?
     
    Thanks,
    Waed Ayyad
     
     
  • CU21091228-0 Profile Picture
    230 on at
    I am running a batch job.
     
    After while (queryRun.next())
    {
      //  Here i will get TableB records
    }
     
    Actually in below i have to set something like + Field2
     
     qbdsTableB.addLink(fieldNum(TableA, Field1 + Field2), fieldNum(TableB, FieldZ));
    It can be achieve using while select
    while select TableA where TableA.CusAccount == '000'
     Outer Join TableB where TableB.FieldZ == TableA.Field1 + TableA.Field2
    {
    }
    Please let me know how to achieve using query.
     
  • Verified answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at
    It's impossible, but a workaround exists. Create a view with TableA as a data source and create a computed column concatenating Field1 and Field2. In your query, join this view with TableB.
     
    Nevertheless if using your tables is difficult like that, it suggests that your data model isn't designed correctly. Consider fixing the data model, rather than just a single query. In this case, it seems that FieldZ violates the first normal form: it isn't atomic.
  • Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at

    Hi, 

    Is your issue resolved? If yes, mark the answers that helped you as verified. 

    Thanks,

    Waed Ayyad

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 499 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans