Questions tagged [sort]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
2answers
30 views

Get all Sobject Label and API name in Ascending order according to the label

Is there any standerd methord to get all Sobjects name in Ascending order. I am able to get all objects label and API name by the following code. I need to put all the names into map in ascending ...
1
vote
1answer
26 views

Map Sort by Object field

I have the following code: @AuraEnabled public static Map<Id,Location__c> getAllStoresInRegion(string currRegion){ LocationService locationService = new LocationService(); Map<Id, ...
2
votes
1answer
81 views

I'm trying to get my map in a certain order based on my list. But the map always return sorted values

Map<String,String> mapvalue = new Map<String,String>(); for (string s : listorder){ mapvalue.put(s, fieldMap.get(s).getDescribe().getLabel()); } Eg;list order is like B,A,C,D Output ...
0
votes
2answers
131 views

SOQL SORTING WITH 2 FIELDS

I have the object Animal__c, with the field ZooId. I want to make an SOQL Query with the animals sorted by CreatedDate DESC and Zoo Id. Now the list is: Animal 0 ZooId 5 CreatedDate Yesterday ...
2
votes
1answer
69 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
146 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
36 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
81 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
47 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
236 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
781 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
54 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
676 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
3k 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
301 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
342 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
185 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
374 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
639 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
592 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
25 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
168 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
127 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
268 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
1k 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
150 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
230 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
780 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
110 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
253 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
698 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
4k 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
248 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
67 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
953 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
50 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
317 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
455 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
182 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
916 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
115 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
520 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
2k 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
78 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
167 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
1k 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 ...