web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

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

Rearranging columns in a Query

(0) ShareShare
ReportReport
Posted on by 236

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

I have the same question (0)
  • Suggested answer
    Amit Profile Picture
    2,557 on at
    RE: Rearranging columns in a Query

    Hi

    Adding info

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-query-object

    Regards

    Amit Sharma

    www.erpconsultors.com

  • M Saravanan Profile Picture
    236 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
    90,244 Super User 2025 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
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sumit Singh Profile Picture

Sumit Singh 2,708

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 2,675 Super User 2025 Season 2

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,203

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans