Sort desc is not working

What are you trying to achieve?

I am following the Make Intermediate 2-1 exercise, unit 1 - the get function, to sort an array by item_name in descending order.
sort(array_name; desc; item_name). But the output is in ascending order, which is wrong.
When I switch from “desc” to “asc”, the output is in descending order,which is wrong again.
I expect sort(array_name; desc; item_name) to return a descending order output, and the sort(array_name; asc; item_name) to return an ascending ouput.
But my result is wrong.

Steps taken so far

Create a Parse Json with this test input,
{
“shopping_basket”: {
“date”: “2023-06-07T10:45:26.894Z”,
“items”: [
{
“item_name”: “Summer hat”,
“item_price”: 25,
“item_color”: “Brown”
},
{
“item_name”: “Basic T-shirt”,
“item_price”: 15,
“item_color”: “White”
},
{
“item_name”: “T-shirt with print”,
“item_price”: 20,
“item_color”: “Black”
},
{
“item_name”: “Leather boots”,
“item_price”: 70,
“item_color”: “Dark brown”
},
{
“item_name”: “Sports socks”,
“item_price”: 9,
“item_color”: “Black”
},
{
“item_name”: “Socks with logo”,
“item_price”: 8,
“item_color”: “White”
}
],
“order_id”: “order-123”,
“total_price”: 147
}
}

Connect Parse Json to Set Multiple Variables, see picture 2
But the output is wrong. See picture 3.

Screenshots: scenario setup, module configuration, errors

You have a stray space before the item_price.

Hope this helps! Let me know if there are any further questions or issues.

@samliew


P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!

2 Likes

Hi @samliew. Thanks! It is working now.

1 Like

No problem, glad I could help!

1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

  • others can save time when catching up with the latest activity here, and
  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

@samliew

1 Like