How to Sort Array in Ascending and Descending Order

By | August 30, 2016

Sorta-is used to sort arrays of single-dimensioned variables.

Sorta, sorts the array in ascending order by default, to sort the array in descending we need to use Desc keyword.

Syntax –

Ascending and Descending Order


Sorta – Number Array List

Number – number is length of an array or up to which number we want to sort

Array List – list of array variable separated by comma


In this example we are having two arrays, sorta command is sorting array NUMBER in ascending order and also STR array


To sort these arrays according to STR array –

Sorta 4 STR NUMBER or

Sorta 4 STR


To sort in descending order –

Sorta 4 STR NUMBER  Desc

Hope this helps.

About Us

Greytrix is one stop solution provider for Sage ERP and Sage CRM needs. We provide complete end-to-end assistance for your technical consultations, product, system integrations, third party add-on development and implementation expertise.

Greytrix have some unique solutions of Sage X3’s integration with Sage and Magento eCommerce. It also offers best-in-class Sage X3 customization and development services to Sage business partners, end users, and Sage PSG worldwide.

For more information on Sage X3 Integration and Services, please contact us at .We will be glad to assist you.

Other Related Blogs:

How to get the number of records modified by Update Command

List the files from the directory

How to overcome the ‘table full’ error in sage x3 while importing the file

How to link and order by with different tables in 4GL

Error while importing folder in Sage X3