Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Order By in MorphX report doesn't work properly in X++ code

(0) ShareShare
ReportReport
Posted on by 157

Hello Everyone

I wrote the code below....
In the first case I try to sort the lines of the report by itemId and ItemRoutId and it works fine 

while select ProdBOMtmp order by ItemRouteId,ItemId
    where ProdBOMtmp.OprNum == ProdRoute.OprNum
    outer join prodJournalBOMselect
        where prodJournalBOMselect.InventTransId == ProdBOMtmp.InventTransId
        && prodJournalBOMselect.JournalId == prodJournalBOM.JournalId
        outer join MyInventItemLocation 
            where MyInventItemLocation.InventItemLocation == prodJournalBOMselect.InventItemLocation



In the second case I try to sort the lines by printingSequence witch is in a custom MyInventItemLocation table
(I already use this field in other reports and the order works fine)


while select ProdBOMtmp 
    where ProdBOMtmp.OprNum == ProdRoute.OprNum
    outer join prodJournalBOMselect
        where prodJournalBOMselect.InventTransId == ProdBOMtmp.InventTransId
        && prodJournalBOMselect.JournalId == prodJournalBOM.JournalId
        outer join MyInventItemLocation order by printingSequence
            where MyInventItemLocation.InventItemLocation == prodJournalBOMselect.InventItemLocation


But in this one doesn't work. 

Does anyone understand why?????

  • MuthukumaranAX Profile Picture
    2,901 on at
    RE: Order By in MorphX report doesn't work properly in X++ code

    Hi SGbron,

    Could you pls mark it as "Resolved, if the issue is fixed.

    thanks

  • SGbron Profile Picture
    157 on at
    RE: Order By in MorphX report doesn't work properly in X++ code

    So I found where the problem was.

    Somewhere in the code the ProdBOMtmp has  the property ProdBOMtmp.setTmp().

    That turns the table to temporary Table.

    So the join statements was not working becasue of that.

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Order By in MorphX report doesn't work properly in X++ code

    Hi SGbon,

    Please try this -

    while select ProdBOMtmp 
        order by MyInventItemLocation.printingSequence
        where ProdBOMtmp.OprNum == ProdRoute.OprNum
        outer join prodJournalBOMselect
            where prodJournalBOMselect.InventTransId == ProdBOMtmp.InventTransId
            && prodJournalBOMselect.JournalId == prodJournalBOM.JournalId
            outer join MyInventItemLocation 
                where MyInventItemLocation.InventItemLocation == prodJournalBOMselect.InventItemLocation

  • nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: Order By in MorphX report doesn't work properly in X++ code

    You say that you use it in some other place and it works fine. Perhaps you can compare your x++ select statements that work, to spot the difference to the one that doesn't work as you would expect.

    These queries and the sort order of the result is not related to MorphX reports, so you can just test it in a job.

    The report simply displays the data that you provide to it, in the order that you provide in the select statement.

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,238 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,923 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans