{"title":"OrderBy Property","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/properties/devenv-orderby-property/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-orderby-property, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-orderby-property","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Sorts table fields in the page view in ascending or descending order.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Applies to","slug":"applies-to","at":130,"chars":32},{"level":2,"title":"Property Value","slug":"property-value","at":162,"chars":362},{"level":2,"title":"Remarks","slug":"remarks","at":524,"chars":565},{"level":2,"title":"Example","slug":"example","at":1089,"chars":740},{"level":2,"title":"Related information","slug":"related-information","at":1829,"chars":69}],"text":"> Version: _Available or changed with runtime version 3.0._\nSorts table fields in the page view in ascending or descending order.\n## Applies to\n Page View\n Query\n## Property Value\n*Column*=Ascending|Descending\n Column is the name of the query column as specified by its Name Property<devenv-properties>.\n Ascending sorts the column from lowest value to the highest value (A to Z, 0 to 9).\n Descending sorts the column from highest value to the lowest value (Z to A, 9 to 0).\n> NOTE\n> Separate multiple columns with a comma.\n## Remarks\nIn the OrderBy property, you add a column by name and set its direction to ascending or descending:\n```al\nview(MyFirstView)\n{\n    Caption = 'This is my first view!';\n    OrderBy = Ascending (Address);\n}\n```\nTo sort on multiple columns, separate each column with a comma, like `OrderBy = ascending (Name), descending (Quantity)`.\n> NOTE\n> You cannot sort on the same column more than once.\n> NOTE\n> For views you can only use one direction; either Ascending or Descending.\nThe OrderBy property corresponds to the Order By clause in SQL select statements.\n## Example\nThis following table shows the results of a query that retrieves the quantity of items in every open sales order for each customer.\nCustomer|Quantity\nThe Cannon Group|50\nNew Concepts|15\nNew Concepts|30\nSelangerian Ltd.|20\nSelangerian Ltd.|60\nTo sort the Customer column in ascending order and the Quantity column to descending order, you set the OrderBy property to `Name=Ascending,Quantity=Descending`. The following table shows the results of the query after sorting.\nCustomer|Quantity\nNew Concepts|30\nNew Concepts|15\nSelangerian Ltd.|60\nSelangerian Ltd.|20\nThe Cannon Group|50\nThe following is the Order By clause in SQL that corresponds to the OrderBy property in this example.\n```al\nOrderBy = ascending (Name,Quantity);\n```\n## Related information\ndevenv-query-properties\ndevenv-view-properties"}