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, ...
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?????

I have the same question (0)
  • nmaenpaa Profile Picture
    101,162 Moderator on at

    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.

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    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

  • SGbron Profile Picture
    157 on at

    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.

  • MuthukumaranAX Profile Picture
    2,903 on at

    Hi SGbron,

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

    thanks

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
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 422 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans