Closed AceTheWiz closed 4 months ago
This message occurs when the property has one or more non unique values. It should ask you to pick another property, like so:
Thanks for the reply.
I did see the dropdown to choose another property, but I specifically want to sort on the name
property.
And yes, the name
property does have duplicates but I was hoping it would sort regardless.
Is there a possibility to override or configure the requirement for unique values ?
Is there any reason you don't want to pick another property to sort the objects with the same value of your first sort property?
Of course such a feature could be added (it is currently not supported) and I remember thinking about it. I just never saw a reason to do so.
For example, this array:
[
{
"name": "Bob",
"email": "bob43@gmail.com",
"age": 36
},
{
"name": "Shyam",
"email": "shyam23@gmail.com",
"age": 28
},
{
"name": "Bob",
"email": "bob32@gmail.com",
"age": 41
},
{
"name": "John",
"email": "john@gmail.com",
"age": 33
},
{
"name": "Ram",
"email": "ram@gmail.com",
"age": 23
},
{
"name": "Bob",
"email": "bob43@gmail.com",
"age": 36
}
]
has 3 occurrences of Bob
. You could either sort by email
as the second sort property or by age
and email
(because 36
appears twice). The Bob
s would be sorted among each other by email
and among the rest of the objects by name
.
Is there any reason you don't want to pick another property to sort the objects with the same value of your first sort property?
The first prompt I get is this
where I chose name
.
The second prompt I get is this
I thought that if I chose another property (e.g description
), then it would only sort on description
and not sort on the name
property anymore.
Now, from your explanation and example, I understand that that the "pick another property to sort the objects" actually adds additional fields to the sort. So, the sort then uses multiple fields to sort.
I tried again and kept adding properties to the sort (2nd image above) until it actually sorted successfully as I wanted. 👍
As an improvement, I suggest the text should say "pick an additional property to produce a successful sort"
Thanks again for your time and for creating this useful extension.
I have a string property named "name". When I choose it to sort I get an error. "Sorting cannot produce a determinable result. Please pick another property"
VSC Version: 1.90.1 (user setup) Commit: 611f9bfce64f25108829dd295f54a6894e87339d Date: 2024-06-11T21:01:24.262Z Electron: 29.4.0 ElectronBuildId: 9593362 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Windows_NT x64 10.0.19045
Any ideas.?