Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [sort]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
57 views

My bubble sort seems to be prioritizing one object over the other. and not actually sorting by createdDate. Can anyone tell why?

I am using a bubble sort to sort two different objects I have within a list. Right now it seems to be putting the Knowledge articles before the Events, and furthermore the Date is not sorting properly....
0
votes
1answer
41 views

Sorting a List of different object Lists by datetime

I have a List<ListWrapper> comprised of List<Knowledge__kav> and List<Community_Event__c>. I would like to sort List<ListWrapper> by date but the two inner lists have different ...
1
vote
0answers
34 views

'Sort By' changes dashboard in metadata

I have a dashboard with unchecked 'Use chart settings from report'. I changed the field in Sort By options and can't find these changes in Dachbord metadata. Where can I find 'Sort By' changes in ...
1
vote
2answers
47 views

Sort AlphaNumeric versions

How to sort the Version(i.e) '1.4.7','5.19.0','5.18.0','5.14.1','5.8.1','5.8.2','5.20.1','5.20.0' something like this. Initially tried with splitting by DOT and then comparing the First value in a ...
0
votes
0answers
56 views

Sort checked row

I have a tab where i save my values in first column. And when I check checkbox I want to copy value from first column then sort it and save in second column. How to implement sort? Any suggestions ...
0
votes
1answer
18 views

Formula(Text) Field Displayed in a Time Format Not Sorted Properly in List View

I have a formula(text) field created that fetches only the time part of a date/time field. Formula(Text) field: Time__c However, upon sorting list view by that formula field, it does not display ...
0
votes
0answers
132 views

Lightning Web Component Custom Sorting [duplicate]

Using the below JS method for the custom sorting to work on a lightning data table. The same works perfectly in aura frame work. I suspect key() doesn't work in lwc. Documentation didn't help much. ...
3
votes
1answer
348 views

What controls the sortDirection arrow in lightning-datatable?

I have a lightning-datatable (lwc) that has a number of columns that are sortable. I'm tracking the sort direction of each column with a separate variable. The sorting works great, including ...
0
votes
1answer
38 views

The sort function is not working properly

I have the following Array of results in contactArray attribute. Here What I need is I'll need to sort the following records by LastModifiedDate of a particular record. In the front end I have 3 ...
1
vote
1answer
368 views

Aura:iteration with Data Tables and setting the order to descending as rows are inserted

So we have a client that has a form page where a Data Table is built based on input. As they enter items the table sorts them by index (i'm assuming) in ascending order. Without making the user sort ...
1
vote
3answers
2k views

How to sort a list of strings in the descending order?

I'm trying to sort the list of strings which has versions but fail to do this: List<String> src = new List<String>{'7.1.2', '8.1.3', '11.0.5', '5.x', '10.0.89', '12.13.14'}; List<...
0
votes
1answer
225 views

How to sort formula showing Image in List View

I have a simple formula field in salesforce which show particular image based on another picklist, as below. IMAGE(IF(ISPICKVAL(Rating__c,"1 Star"), "/img/samples/stars_100.gif", IF(ISPICKVAL(...
6
votes
2answers
244 views

SOQL with ORDER BY and NULLS LAST ASC return wrong order results when we order by field from relationship

I noticed that SOQL with ORDER BY and NULLS LAST ASC returns results in wrong order (especially when I order by field from relationship). I wonder if it is some kind of bug or I've done some mistake ...
0
votes
2answers
132 views

Apex Keyset- Sort values in DESC order while binding to picklist

I am trying to sort values in desc order before binding these to picklist. I have referred to some posts regarding sorting(This post) and implemented the below: Take keySet() of the map. Convert ...
0
votes
1answer
255 views

Sort field set in Visualforce renderAs PDF with apex:repeat

Can anyone help me to sort a field set that I'm iterating through with apex:repeat? I have a Visualforce page that renders some data as a PDF using Field Sets and I just want the ability to sort the ...
1
vote
2answers
407 views

Sort a Map values apex [duplicate]

I have a map of Map<String,Decimal> test = new Map<String,Decimal>(); In this map i am adding values like classname and codepercentagecovered and iterating over the map and creating ...
1
vote
1answer
437 views

Lightning client side sorting (using a separate function, not inline)

I'm trying to implement a sorting function for the records returned by a callback. The normal javascript a.value - b.value inline implementation is working. This is the working code that I have: /...
0
votes
0answers
23 views

Order by if data is same for a field

In visualforce page which use apex:repeat, and also for client side sorting uses datatable.js. A field column with date type is shown. Also the page allows inline editing, on successful edit it will ...
0
votes
1answer
139 views

How to sort a dynamic picklist

I have a visualforce page where I am displaying dynamic picklist Visualforce code: <apex:selectList value="{!SelectedNomination}" size="1" id="a"> <apex:selectOptions value="{!...
0
votes
1answer
98 views

apex:repeat group by/filter by field, show only unique values

So I have an SOQL query which returns an object with these fields: |Product Name|Option|Category| Category could be: A B Options could be: 1 2 3 In my VisualForce page I would like to visualise ...
1
vote
2answers
217 views

ERROR: Dynamic sorting in Wrapper class' column header

I have implemented a Wrapper class using this: Salesforce Wrapper Class. Now I am trying to implement sorting for the column header which turns out to be throwing error: Invalid field Account.Name ...
2
votes
1answer
888 views

Client side sorting based on Parent Fields

Client-side sorting in Lightning Component, In my component I have Parent Records as well, so I need to sort based on Parent Records also. Currently, I'm doing sorting on Server side but I want to do ...
0
votes
0answers
124 views

Sort Related List according Boolean formula field

In my account page I present all the account products. Each product object has custom boolean filed - formula type. This formula calculate if the product license is valid or not. In the GUI - there ...
2
votes
1answer
163 views

Sort a list of tasks by date value

I'm trying to sort a list of tasks by their due date in ascending order. I've looked in a couple of forums and none are what I exactly need. I'm sure this should be relatively easy but haven't found ...
3
votes
1answer
748 views

Sort wrapper list in Apex based on Levels

I have created a wrapper which contains an account record and a string describing the level of account Platinum, Gold, Silver. public class PartnerWrapper implements Comparable { public Account ...
1
vote
1answer
92 views

problem with sorting Quote

I have following custom quote page and controller but the problem is sorting is not working properly, When i click on column for sorting ascending and descending it will not show me the list with ...
1
vote
1answer
202 views

How can we sort wave report by number column?

I have created a Wave Report which I need to sort by Number field. I am not able to add Formula(Number) in Group by column even with using SAQL. I have already tried the workaround to change Formula(...
0
votes
1answer
605 views

Sorting a keySet

I have a list that I created with a Wrapper Class and a Comparable/compareTo method. So it is sorted the way I would like it. From this list I created a Map with the key being the list's Created Date. ...
7
votes
1answer
3k views

How to sort Map by values

I need to loop through Accounts and then on all of the Contacts for those Accounts. I need to find what is the address with the most occurrences in Contacts for each Account and update the Account ...
0
votes
2answers
1k views

compareTo method not sorting result in list

I have created attachment info object and using wrapper class to store attachment related information. I have created visual force page to display attachment with attachment information using wrapper ...
0
votes
1answer
211 views

Sort Order In OpportunityLineItem Preview

We have Sort button in OpportunityLineItem. Using this, customer may able to sort the products in the order they want, but in Preview (Visualforce page preview) it's dispaying default order (...
0
votes
0answers
14 views

Trying to sort on 2 field for wrapper list. First on dueDate then on timeAllocated. Im having trouble with the CompareTo [duplicate]

global class TimeSortWrapper implements comparable { public TableData timeObject; public TimeSortWrapper(TableData t) { timeObject = t; } global Integer compareDate(Object ...
0
votes
1answer
62 views

Dynamic sorting in related lists in Salesforce classic

It seems I can't change the sorting order of a related lists inside the Account layout. Is it possible to allow the user to change the sorting column of a related list without "going to list" ?
0
votes
1answer
838 views

Bubble sort with Number field in Wrapper Class List

I would need some idea on how to sort a number column in Wrapper class. Wrapper class list is received from Callout and not by querying any SoBject. So cannot use ASC/DESC. Tried out comparable ...
0
votes
0answers
48 views

Products to opportunities, and the SortOrder field

While adding products to an opportunity in Salesforce, you can not specify the values for the 'SortOrder' field on Opportunity Line Items. That is very weird, and is a feature requested more than 7 ...
1
vote
1answer
283 views

Can we sort report columns using Report API via APEX? I found this on the document 'Reports.ColumnSortOrder' but there's no example

I have the below codes to get and run report using Reports API via apex but I need to the sort the first column of the report. List <Report> reportList = [SELECT Id,DeveloperName FROM Report ...
3
votes
2answers
323 views

Cannot sort on numeric field with SOQL in Custom Metadata

Cannot sort on a soql-request in a custom meta data type. When i perform SELECT .. FROM x__mdt WHERE ... ORDER BY x. Then field x cannot be numeric to get a correct order. Change it to a string-field ...
2
votes
1answer
162 views

Is there a better way to order my collection?

I'm trying to display a chronological list of CaseHistory records to display case edits. I have the following code: public Map<CaseHistory,String> getHelpdeskHistory() { List<...
1
vote
1answer
766 views

Natural sorting(Text with Numbers) for String in Apex [closed]

I must sort strings like "Text x.x.x(Text x)", "Text x.x.x", etc.(where x - number) in right way in Apex. Something like that: Input - ['Test 1.2(V 1000)', 'Test 1.10(V 1001)', 'Test 1.2(V 1001)', '...
4
votes
1answer
108 views

Can I change Product lookup sort order?

I would like my Product lookup to list by Product CODE and not by Name, as it is now. It seems I cannot do that as I get an error saying 'Error: Product Name cannot be removed and must be the first ...
4
votes
1answer
3k views

Map<Id,List<CampaignMember> Where Key is a different SObject

I'm trying to find a way to populate a Map<Id,List<SObject>> Where the key is an Id of a different SObject. Specifically, I'd like to return campaign members associated with contacts at an ...
0
votes
4answers
444 views

Decrement Max Value From Map?

How can I sort a Map based on value? Here is the Map structure: Map<DateTime, Integer> AppDetails = new Map<DateTime, Integer>(); And the data: 2016-10-1,10 2016-10-2,3 2016-10-3,...
5
votes
2answers
1k views

apply sorting in apex repeat tag

I'm new in Salesforce. I've created a custom field (type text (10) ) in accounts. I want to group accounts by text (level 1, level 2, level 3) and add drag and drop to move account in groups. Thank ...
3
votes
0answers
77 views

Does List<SObject>.sort method implementation depend on version?

I believe that I have found very interested undocumented bug in Salesforce. I don't see in the documentation saying that List.sort method implementation depends on version, but looks like it does. If ...
2
votes
1answer
146 views

Descending Table With Two Objects

I have a table that lists out two different objects in descending order. The issue is that the list is returning all of one object and then all of the second object. It is still in one table but the ...
0
votes
3answers
986 views

Sort List in Descending Order by BMCServiceDesk__date__c or CreateDate

I am working on a custom controller to sort the below apex:repeat list in Desc order by BMCServiceDesk__date__c or CreatedDate. Part of my VF email template and Controller code is below. I am ...
7
votes
2answers
167 views

Significant elapsed time differences when calling sort() on different Comparable implementations

Before I dive into a bit of code, a summary of my question is: does anybody know what Salesforce does internally when calling .sort() on a List of custom classes? Scenario: I have a wrapper class ...
0
votes
2answers
3k views

Get max(field) from List of sObject in salesforce

I have List of Records for which I want to find out Maximum value for particular Field: Can anyone suggest me, any efficient way (rather than writing Sorting Method) Example : public decimal ...
0
votes
1answer
94 views

SOQL not working

I have a dynamic SOQL query where in I am using order by clause.I want to sort it by product Style SOQL soql = 'select id, name,Warehouse__c,Product_Reference__r.gii__ProductStyle__r.name, ...
3
votes
1answer
239 views

Notes & Attachments Wrapper class not sorting by LastModifiedDate correctly

I am using the below code with the Comparable interface to build a combined list of all the attachments and notes on a record, sorted in descending order of LastModifiedDate (in constructor of main ...