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, ...
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
    237,904 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
    237,904 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
    237,904 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
    237,904 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

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 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans