Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
844 views

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 ...
 HigoChumbo 's user avatar
-1 votes
1 answer
100 views

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 ...
Bhavya Patel's user avatar
0 votes
1 answer
51 views

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 ...
Jordan's user avatar
  • 307
1 vote
2 answers
129 views

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 ...
Lloyd Banks's user avatar
  • 36.9k
-1 votes
1 answer
105 views

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....
Jaykumar's user avatar
  • 443
-2 votes
1 answer
140 views

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. ...
Shubham Kumbhalkar's user avatar
-2 votes
1 answer
57 views

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): ...
Syed Sameer Sohail's user avatar
0 votes
1 answer
31 views

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 ...
Codeigniter Developer's user avatar
-1 votes
2 answers
74 views

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" =...
Gabriel91's user avatar
  • 141
3 votes
2 answers
228 views

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 ...
Jackom's user avatar
  • 436
1 vote
4 answers
287 views

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 $...
rolinger's user avatar
  • 3,196
0 votes
2 answers
2k views

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 '...
Manuel Yerbes's user avatar
-2 votes
2 answers
926 views

I have a python function that receives this 2 arguments: list = [ {"id": "5", "name": "tomato", "value": 3}, {"id": &...
jpdoliveiramc's user avatar
0 votes
2 answers
182 views

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 ...
Uchenna Ajah's user avatar
0 votes
1 answer
47 views

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 ...
Karthikeyan Amaresan's user avatar
1 vote
2 answers
85 views

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 ...
Dominique's user avatar
  • 17.7k
0 votes
2 answers
90 views

I have a List<string>, where the entries are locations, like "010101", "010102", "010201", ..., with following meaning: First two characters : floor Next two ...
Dominique's user avatar
  • 17.7k
0 votes
2 answers
227 views

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): ...
Learning's user avatar
  • 127
0 votes
1 answer
440 views

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 ...
Vats Patel's user avatar
1 vote
1 answer
666 views

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 ...
sruthi_ys's user avatar
1 vote
4 answers
74 views

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);...
Antony's user avatar
  • 4,442
0 votes
0 answers
610 views

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) ...
student214's user avatar
0 votes
2 answers
190 views

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 ...
TheOldBlackbeard's user avatar
-1 votes
2 answers
157 views

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/...
Jack co's user avatar
0 votes
2 answers
845 views

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) ...
me.at.coding's user avatar
  • 18.5k
2 votes
1 answer
615 views

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". ...
Abhishek Agarwal's user avatar
1 vote
1 answer
155 views

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 ...
dmah's user avatar
  • 63
-1 votes
1 answer
2k views

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 ...
sifar's user avatar
  • 1,158
0 votes
1 answer
2k views

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 ...
Rich R's user avatar
  • 21
3 votes
5 answers
1k views

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&...
wannaBeDev's user avatar
3 votes
1 answer
386 views

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', '...
Kaloyan Georgiev's user avatar
0 votes
1 answer
1k views

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 ...
Sahil Kumar's user avatar
1 vote
2 answers
685 views

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&...
Luqman Ahmad's user avatar
1 vote
1 answer
69 views

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, '_'); }); ...
Bruno Ferreira's user avatar
1 vote
3 answers
1k views

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 ...
strangeQuirks's user avatar
1 vote
1 answer
359 views

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>, <...
trex's user avatar
  • 4,087
-2 votes
1 answer
598 views

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,...
Dhaval Makwana's user avatar
0 votes
2 answers
49 views

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 ...
hans's user avatar
  • 29
0 votes
2 answers
2k views

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, ...
jms2505's user avatar
  • 68
1 vote
4 answers
254 views

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 ...
Michael Brown's user avatar
0 votes
2 answers
43 views

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 ...
Imran Hemani's user avatar
1 vote
2 answers
63 views

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. $...
Patrickmid7's user avatar
1 vote
1 answer
483 views

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 ...
xddev's user avatar
  • 13
1 vote
0 answers
29 views

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 ...
Fabian's user avatar
  • 651
3 votes
0 answers
879 views

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 ...
Sunny's user avatar
  • 68
-1 votes
2 answers
1k views

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 ...
yash bhawsar's user avatar
1 vote
1 answer
1k views

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, $...
ssarljames's user avatar
1 vote
2 answers
444 views

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', ...
Shoaib Chikate's user avatar
1 vote
2 answers
50 views

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 ...
R. Tanjung's user avatar
-2 votes
2 answers
85 views

I have a multidimensional array in this structure: $arr = [ 0 => ['ref' => 'Q1'], 1 => ['ref' => 'C6'], 2 => ['ref' => 'C13'], 3 => ['ref' => 'S3'], 4 => ...
bozsudo's user avatar
  • 63