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, ...
Suggested Answer

temp table and strReplace

(0) ShareShare
ReportReport
Posted on by 80

Hi,

 I had a small question.

Could there be something like the following in the query I use for tmpTable?

 ECompanyOrderNo is guid field but CompanyOrderNo is str

 *

   *

   *

join arcBodDeliverySerial

      where strReplace(strReplace(guid2Str(inventTrans.ECompanyOrderNo),"{",""),"}","") == BodDeliverySerial.CompanyOrderNo

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

    What is the role of InventTrans and BodDeliverySerial tables in the query? Do you have both of them in the query and you're definign a join condition? Or are you querying InventTrans records and filtr them by a value coming from outside the query?

    Also, you mentioned a temporary table. Where are you using it?

  • dynamicscon Profile Picture
    80 on at

    I want to inner join with InventTrans and BODDeliverySerial tables.

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

    Okay, and where is the temporary table? Is BODDeliverySerial temporary, or what do you mean?

  • dynamicscon Profile Picture
    80 on at

    Code like this:

    while select salesLine

               join inventTrans

                   where salesLine.InventDimId == inventTrans.InventDimId

               join BodDeliverySerial

                   where guid2Str(inventTrans.ECompanyOrderNo)  == BodDeliverySerial.CompanyOrderNo

           {

                   tmpTable.clear();

                   tmpTable.EOrderDate = salesLine.EOrderDate;

                   tmpTable.ECustName = salesLine.ECustName;

                   tmpTable.CustAccount = salesLine.CustAccount;

                   tmpTable.inventSerialId = inventDim.inventSerialId;

                   tmpTable.ItemNameDisplay = tmpTable.ItemNameDisplay;

                   tmpTable.ItemId = salesLine.ItemId;

                   tmpTable.SalesId = salesLine.SalesId;

                   tmpTable.insert();

           }

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

    Okay, so the temporary table isn't really relevent to the problem.

    When you have problem to query the data, it usually means that your data model is wrong. If you have two fields that contain logically identical values, the fact that they don't have the same data type looks wrong to me. Isn't fixing this problem the right approach?

  • dynamicscon Profile Picture
    80 on at

    Yes Martin! I already said so. I mentioned it in my first post. I think there is a problem with the conversion there.

    The system before me was set up this way and I don't need to make any changes so as not to affect other forms.

    I'm trying to find another way and thought of things like guid2str but it didn't work.

  • Suggested answer
    Martin Dráb Profile Picture
    239,152 Most Valuable Professional on at

    There is no translation of X++ functions to T-SQL code, which is what is sent to database.

    The right approach would be fixing the bug in the data model. If you can't do that, you'll need to come up with a workaround. For example, you can create a view for one of those tables and add a computed column, which would convert the value to the right data type. I would create a view for BodDeliverySerial, because it'll likely have less records than InventTrans.

    Then you'll join inventTrans.ECompanyOrderNo with the computed column of the view.

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 681

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 218 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans