Input collection: myCities35
City | Country | Population |
Los Angeles | United States | 4000000 |
Toronto | Canada | 2930000 |
New York | United States | 8500000 |
Vancouver | Canada | 1780000 |
Output collection: mySolution35a (sort by Highest to Lowest Population)
City | Country | Population |
New York | United States | 8500000 |
Los Angeles | United States | 4000000 |
Toronto | Canada | 2930000 |
Vancouver | Canada | 1780000 |
Solution code:
//Create a collection
ClearCollect(myCities35,
{City: Los Angeles , Country: United States , Population: 4000000},
{City: Toronto , Country: Canada , Population: 2930000},
{City: New York , Country: United States , Population: 8500000},
{City: Vancouver , Country: Canada , Population: 1780000}
);
//Sort by column code
ClearCollect(mySolution35a,Sort(myCities35,Population,Descending));
Output collection: mySolution35b (sort by Country and Population)
City | Country | Population |
Toronto | Canada | 2930000 |
Vancouver | Canada | 1780000 |
New York | United States | 8500000 |
Los Angeles | United States | 4000000 |
Solution code:
//Create a collection
ClearCollect(myCities35,
{City: Los Angeles , Country: United States , Population: 4000000},
{City: Toronto , Country: Canada , Population: 2930000},
{City: New York , Country: United States , Population: 8500000},
{City: Vancouver , Country: Canada , Population: 1780000}
);
//Sort by multiple columns code
ClearCollect(
mySolution35b,
SortByColumns(myCities35, Country ,Ascending, Population ,Descending)
);