121 questions
0
votes
2
answers
844
views
Power Automate Cloud: Custom sort (Excel) array by multiple columns
I can't seem to figure out how to do a custom sort for an array (like an Excel Table) that sorts hierarchically by multiple columns, like sort by date then by time then by room.
The ODATA filter ...
-1
votes
1
answer
100
views
External Data Structure Used in Custom Comparison Function in C++ [duplicate]
I have array of numbers and I have to sort them based on there frequency in ascending order
and if both numbers are same then sort them in decreasing order
what I did was I create unordered_map and ...
0
votes
1
answer
51
views
Custom Sort Data table Column - first all numbers , String and null
I am trying to sort my data table based on custom requirement where I need to Sort first numbers , Second String and then null values at bottom of table. I have created data table where there are ...
1
vote
2
answers
129
views
PHP - usort() With Partial Case Sensitivity
I have the following array items:
[{
first_name: 'Rebecca'
}, {
first_name: 'amy'
}, {
first_name: 'Amy'
}, {
first_name: 'stacy'
}]
I want the array to be sorted alphabetically ...
-1
votes
1
answer
105
views
method sort(List<T>, Comparator<? super T>) in the type Collections is not applicable for arguments (ArrayList<Product>, CustomProductComparator)
Product with fields (id, productName, categoryName, etc).After making Arraylist of product and Populating it with Values like
ArrayList<Product> products = new ArrayList<Product>(Arrays....
-2
votes
1
answer
140
views
Custom sort for HashMap on Priority Queue [duplicate]
I want to get the sorted key value pair on value, and if the values are equal, I wanna sort on keys asc.
I tried using PriorityQueue like following but I am getting null pointer for some reason. ...
-2
votes
1
answer
57
views
Custom Sort in Python
In Python,using custom sort,concatenate array elements such that the result will be greatest value from those elements.
T = int(input("Enter number of test cases: "))
for _ in range(T):
...
0
votes
1
answer
31
views
Codeigniter 3 order_by dopings
I have 4 types of doping.
I need some sorting on the categories page.
Those with doping types 1 and 4 will be listed as DESC at the top, those with type 1 at the bottom, those with type 4 at the ...
-1
votes
2
answers
74
views
Sort delimited array values by first half ascending then by second half descending
I am trying to sort my array values with sizes but the result is not as I expected.
This is my code:
function cmp($a, $b) {
$sizes = array(
"XS" => 0,
"S" =...
3
votes
2
answers
228
views
Custom sort on value suffix representing sizes (XXS, XS, S, M, L, XL, XXL)
I'm trying to sort my array values by size but I have a problem.
My array pulls out values that are different than the values of the "cmp" function used to sort.
The code is this:
function ...
1
vote
4
answers
287
views
Sort a 2d array by the order of corresponding values in another 2d array
I have two multi-dimensional arrays and need to sort the first array in the same order as the second array based on different keys (but their values are the same). In the below example I need $...
0
votes
2
answers
2k
views
custom sorting v-data-table with strings values
My goal is to be able to sort DEST or ASC the table. To do this, in the array 'tableItems' I get unformatted numbers, which I format to have the dot for thousands and the comma for decimals with the '...
-2
votes
2
answers
926
views
Sorting based on custom sort key
I have a python function that receives this 2 arguments:
list = [
{"id": "5", "name": "tomato", "value": 3},
{"id": &...
0
votes
2
answers
182
views
Custom sort flat array by negative numbers, uppercase letters, symbols, lowercase letters, then positive numbers
I've been cracking my brain trying to solve this challenge.
PHP default sort function doesn't provide the solution but still, using usort isn't easy either.
So this is what I'm trying to solve. I ...
0
votes
1
answer
47
views
How to do collation sorting with lowercase first?
Input
For the given list of below strings,
Senthil
Anbu
arthi
Sugumar
suresh
venila
Expected
I want the sorting order to be
arthi
Anbu
suresh
Senthil
Sugumar
venila
Actual
But getting the follow ...
1
vote
2
answers
85
views
How to use custom sorting, based on the "Sort()" method of List<OwnObject>
In a previous post, I wanted to custom order a list of strings (List<string>). This is working fine now.
Now I would like a step further and sort a list of objects, having the mentioned strings ...
0
votes
2
answers
90
views
Custom sort of List<string>
I have a List<string>, where the entries are locations, like "010101", "010102", "010201", ..., with following meaning:
First two characters : floor
Next two ...
0
votes
2
answers
227
views
TStringList.CustomSort: Compare() with variables
I am trying to custom sort a TStringList by a column in a .CSV file. My code below works (slowly, about 14 seconds for 200,000+ lines):
function Compare(List: TStringList; Index1, Index2: Integer): ...
0
votes
1
answer
440
views
Custom Sorting in Mongoose
I have the following schema of story:
story : {
content: string,
seenBy: Types.ObjectId[]
}
here seenBy is the array of users,
Now I have a list of stories and I want to sort the list based on ...
1
vote
1
answer
666
views
Getting the sorting order (asc/desc) from inside a material-table customSort function
Im new to react js and im trying to sort the dates...the problem is the dates have null value and i want the null dates to always appear at the last irrespective of the order('asc' or 'desc')....i ...
1
vote
4
answers
74
views
Sort array values by their existence in a blacklist array, then alphabetically
I have the following code:
$check = array('person a','person c');
$data = array('person c','person a','person d','person e');
define('check',$check);
//asort($data);
print'<pre>';print_r($data);...
0
votes
0
answers
610
views
Excel macro that executes a multi-level custom sort using a custom list for ordering
I am trying to create a macro that executes a two-level sort using a custom list for a dynamic table.
Level 1: Sort by (Range "C2") // Sort on (Cell Values) // Order (Oldest to Newest)
...
0
votes
2
answers
190
views
Extjs Sencha UUID custom sorting
I am trying to implement a custom sorting of the column UUID of my grid. I would like that the sorting reflects the sorting of the database by displaying the data for example in descending order, as ...
-1
votes
2
answers
157
views
Sort an array of rows by two columns while not moving "locked" (sticky) rows
I need to sort an array of items by score, then by date without moving the rows where the lock value is greater than zero.
In other words, the rows with lock=3 and lock=5 should stay in the same/...
0
votes
2
answers
845
views
Sort only specific items in a list of items
Consider the following code:
// Apple
internal record class Apple(int Id);
// Orange
internal record class Orange(int Id);
// Input
// Note how Apple(1) is followed by Apple(3) and not by Apple(2)
...
2
votes
1
answer
615
views
How to sort in matlab using a custom comparator function
I am writing a program to find max possible number that can be formed from a vector of numbers in string format.
Like A = ["3" "30" "33"] should give "33330". ...
1
vote
1
answer
155
views
Log sorting - Custom sorting is not working
Trying to sort the array 0f log versions in ascending order. I can get it to work by directly implementing Comparator as
Arrays.sort(input, new CustomComparator())
and writing the same logic as ...
-1
votes
1
answer
2k
views
Sort ADO Recordset Fields based on Custom Order
I have created an ADO Recordset from a Range of a Worksheet as shown below that I want to custom sort on Groups field, Then Type field. The Sort Order should be such that, the values of Groups column ...
0
votes
1
answer
2k
views
react-table multisort does not work when providing a custom sort function
Multisort seems to work just fine...as long as you are using built-in sort types (see this example, which loads with the first two columns included in the default sort). As soon as I attempt to use a ...
3
votes
5
answers
1k
views
How to sort a list into a custom order forming kind of distinct groups
I have a list of unsorted strings, where entries are one of {A,B,C,D}:
List<String> strings = new ArrayList<>(Arrays.asList("A","C","B","D","D&...
3
votes
1
answer
386
views
Django queryset custom order
I would like to make a queryset, which will first order by title then by size, but the size should be custom ordered, like the order in the list.
For example
order_size_ist = ['S', 'M', 'L', 'XL', '...
0
votes
1
answer
1k
views
Custom Sort Order by Ids as array in elastic search
The scenario is like this we send the products id's in array as [101,102,103,.....so on ]
but in response we aren't getting the results in the same order is there any way to get the records in the ...
1
vote
2
answers
685
views
Sort characters in string giving priority by lower-case, then upper-case, then numbers then symbols
I am new to PHP and trying to do programming questions that involve sorting. I want to solve this problem in which the input and output are as followed.
Before Sort: 6Ata7~58jh&*(*HLy^)&a[yjJ&...
1
vote
1
answer
69
views
How to improve performance of usort() when the callback function calls a function on both values being compared
I have a problem similar to this post : PHP sort array by number in filename
I used this usort() solution:
usort($photos, function ($a, $b) {
return strstr($a, '_') <=> strstr($b, '_');
});
...
1
vote
3
answers
1k
views
Sorting flat associative array by values DESC, then by whitelisted keys
I have the following array:
$array = [
'z' => 2,
'd' => 1,
'a' => 2,
];
Now I would like to sort by the value (integer) and then sort by the key based on whether it is in this ...
1
vote
1
answer
359
views
Sort django users with specific groups on the top
All users of the application are mapped to at least one group. Here is list of available groups:
>>>Group.objects.all()
<QuerySet [<Group: superuser>, <Group: maintainer>, <...
-2
votes
1
answer
598
views
How to fetch MySQLi data order by array values?
I have created an array, it is used to fetch data from MySQL server.
$ids = array(249853, 245549, 249851, 245552, 245551, 249854, 245550, 282445, 261747, 249852, 222398, 248072, 248390, 272473, 219212,...
0
votes
2
answers
49
views
Sort a 2d array by values in a column related to a flat priority array
I have an array with IDs that looks like
$order_ids = array(8,9,10,4,7);
and another multidimensional array that looks like
$multiarray = [
[4, 23, 1],
[9, 66, 4],
[8, 17, 3],
];
I ...
0
votes
2
answers
2k
views
Sorting tree view nodes by type and alphabetically A->Z
I'm working on an application that uses a tree view. The tree view has three type of nodes:
Root nodes: Those ones can not be sorted, their tag contains the string
"Root" to identify them, ...
1
vote
4
answers
254
views
SQL Server custom sort while grouping by max sum
I have 3 columns (Year, Number, SUM(Amount)) and I am trying to sort them by the max sum of amount.
SELECT TOP 1000
YEAR(period) AS [Year], id_number,
SUM(ISNULL(amount, 0)) AS [Amount]
FROM ...
0
votes
2
answers
43
views
Oracle SQL - Custom Sort
I have a scenario where I have following data:
Table: Locations
ID TYPE
------------------
1000 STORE
11001 STORE
20000 STORE
1181 WAREHOUSE
12002 STORE
I want to sort in a way that ...
1
vote
2
answers
63
views
Sort an array based on related data in a 2d array
So I've searched for hours but no thread seems to get me to a working solution.
My problem;
I've got 2 arrays. 1 array with the user's roles. And one array with all roles with an specific order.
$...
1
vote
1
answer
483
views
python: custom sort: not purely lexicographical but reverse and shortest common first
Background
I want to sort reverse but not strict lexicographical and then it gets even more weird.. :P
The reason is that a proprietary software parses directories exactly the way I describe here and ...
1
vote
0
answers
29
views
Mongo query latest version of entries
I try to get every latest entry of a "group" out of Mongo.
You can image the data like a set of wiki entries:
Each entry can be edited (and old versions are kept).
We are interested in the ...
3
votes
0
answers
879
views
Kotlin Custom sorting on Map
I have map of this object Map<String, List>. It is coming from backend and I wanted to sort it on Key.
Key will be any of this: CHECKING,SAVINGS, CREDIT, LOAN.
I want to sort the map in this ...
-1
votes
2
answers
1k
views
Sorting using custom comparator function in python
i have a list L = [['92', '022'], ['77', '13'], ['82', '12']]
want to sort on second element as key : ['022','13','12']
having to custom functions for numerically sort and lexicographically sort.
but ...
1
vote
1
answer
1k
views
Is there a switch-case equivalent for laravel eloquent query when()?
I'm just curious if there's a switch-case equivalent for when() query
I want this code to use when() with default (if no "when" are used)
public function scopeSortBy(Builder $query, $field, $...
1
vote
2
answers
444
views
How to sort on multiple columns using JavaScript sort?
I have following array that needs to be sorted with respect to search text 'John'.
{id: 1, firstName: 'User', lastName: 'John', nickName: 'Smith'},
{id: 2, firstName: 'Test', lastName: 'John', ...
1
vote
2
answers
50
views
Custom sort a flat array of scalar values so that integers are given top priority
I have an array like this:
$arr = [456, 8, 1, -9, 'string', true, 0, -65, -162];
I want to sort array values descending and also I want integer values to be above the other value types,
I've tried ...
-2
votes
2
answers
85
views
Sort single-column rows of a 2d array by string prefix in a custom order then by string suffix naturally; and re-apply original keys to result
I have a multidimensional array in this structure:
$arr = [
0 => ['ref' => 'Q1'],
1 => ['ref' => 'C6'],
2 => ['ref' => 'C13'],
3 => ['ref' => 'S3'],
4 => ...