Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Rearranging columns in a Query

(0) ShareShare
ReportReport
Posted on by 138

Hi Members,

I need to arrange the columns in a query which are fetched from multiple tables in Business Central. For instance, consider a scenario where I am using 3-4 tables in Business central and fetching datas in the same way which I had entered in the query page. But when I am doing so, I am not able to get or able to arrange the columns in an orderly way which I actually needed.

Please suggest me a solution to the current issue that I am facing.

Thanks & Regards,

Saravanan M

  • Suggested answer
    Amit_Sharma Profile Picture
    Amit_Sharma 2,545 on at
  • M Saravanan Profile Picture
    M Saravanan 138 on at
    RE: Rearranging columns in a Query

    Dear Yunzhu,

    Thank you for your reponse. I would like to inform you that I already went through your blog related to the 'Query Category'. It was very helpful and a great guidance to my learning. But, here the scenario goes like, arranging the columns fetched from various tables in Business Central through Query. For example, consider that I am taking three tables.. i.e Sales Invoice, Sales Invoice Header, Sales Invoice Line. Consider a situation that I am choosing around 10 fields from each table and writing a query. When the Query page is executed, I could find all the fields that I had mentioned in the query retrives with value. Now I wish to change the order or position of the columns(fields) accordingly (For Ex., Sales order number, Sales order document number, Item number, Item Description, Quantity, Price etc.) to establish a pleasing view (between the fields that are related with one another) who runs the query. 

    Please suggest me an alternative solution to the current scenario.

    Thanks and Regards.

    Saravanan M 

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 75,561 Super User 2024 Season 2 on at
    RE: Rearranging columns in a Query

    Hi, Generally for Query, you can use the OrderBy Property to sort table fields in the page view in ascending or descending order.

    If this does not meet your needs, I suggest you create a page to display the data of this Query, which can do more things. more details: https://yzhums.com/4869/

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-orderby-property

    For examlpe,

    query 50100 "ZY Purchase Order Query"
    {
        Caption = 'ZY Purchase Order Query';
        OrderBy = Descending(Buy_from_Vendor_No_);
        QueryCategory = 'Vendor List', 'Purchase Order List';
    }


    Hope this helps.
    Thanks.
    ZHU
  • Suggested answer
    Andy Sather Profile Picture
    Andy Sather on at
    RE: Rearranging columns in a Query

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    I will open this up to the community in case they have something to add.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,602 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,340 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans