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

  • Suggested answer
    Martin Dráb Profile Picture
    231,880 Most Valuable Professional on at
    RE: temp table and strReplace

    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.

  • dynamicscon Profile Picture
    80 on at
    RE: temp table and strReplace

    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.

  • Martin Dráb Profile Picture
    231,880 Most Valuable Professional on at
    RE: temp table and strReplace

    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
    RE: temp table and strReplace

    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
    231,880 Most Valuable Professional on at
    RE: temp table and strReplace

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

  • dynamicscon Profile Picture
    80 on at
    RE: temp table and strReplace

    I want to inner join with InventTrans and BODDeliverySerial tables.

  • Martin Dráb Profile Picture
    231,880 Most Valuable Professional on at
    RE: temp table and strReplace

    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?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,099 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,880 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans