Questions tagged [sort]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
43 views

How to sort list of dates in apex and return the entire record? [duplicate]

I have a custom object called Insurance which has a Start Date field. I am planning to use bubble sort to sort the records based on the Start Date. This is what I have tried so far and got confused as ...
0
votes
1answer
52 views

Sorting records in a before trigger

I have a one to many relationship between Project and Insurance. When a record is created on Insurance object, it needs to get the Project record and then count how many Insurance records are present ...
0
votes
0answers
16 views

Sort List by CreatedDate [duplicate]

I have a following wrapper class: public with sharing class HistoryRecordWrapper { Id CreatedById; Datetime CreatedDate; Object Field; Object NewValue; Object OldValue; public HistoryRecordWrapper(...
1
vote
3answers
40 views

Check if an array is sequentially increasing (the values should increase at each indexes) [closed]

I'm trying to find if array is sequentially incremental. Array A --> {0, 123, 123} This wont be an incremental list as its value is not getting increased sequentially Array B --> {200, 270,800} ...
9
votes
1answer
61 views

Why the Sorting Logic in Salesforce SOQL and UI is VERY different from other Systems?

The ordering mechanisms in Salesforce are really odd. Take any SObject having any Text field (e.g. Name on Account) and create some Records. Do that on an Org with no other Records of the type (e.g. a ...
0
votes
1answer
21 views

Salesforce - Lightning Database with lazyload and Sorting

How can we use lightning data table lazy load functionality with sorting of columns? As Lazy load only will bring certain no of records at a time then sorting actually is working on those set of ...
2
votes
1answer
93 views

LWC Datatable sort - how do I not use a url to sort name hyperlink column?

I have a datatable in my LWC with sorting that all works well, except when I want to sort on a link it is obviously using the fieldName "nameUrl" to sort with, rather than the label. My ...
0
votes
1answer
28 views

Sorting of DateTime field in Angular JS [closed]

I have a requirement where in I need to sort records in the descending order of DateTime type field in angular JS, used in vlocity template. If I am trying to sort just by Date type field, then the ...
-1
votes
1answer
32 views

List Order by number value [closed]

i convert json to list: [ { name: "file.png", time: 1600813341124345 }, { name: "file2.png", time: ...
0
votes
0answers
16 views

No results in a Salesforce standard list view when searching and sorting by date

We have a standard Salesforce list view for Cases. It has 7 exact match filters on it as well as filter logic. When we search the case list for a customer name, we get results. When we sort the list ...
0
votes
2answers
715 views

Sorting on Date field in lightning data table is only sorting with Day not with Day month and year(complete Date value) in LWC

Hi I have a lightning data table in which sorting on Date field is only sorting with 'Day' not with Day month and year(complete Date value) in LWC. Lightning Data Table : Code I am using for sorting :...
0
votes
1answer
240 views

Currency symbol not appearing for lightning data table currency type field in LWC

I have lightning data table with one of the columns associated to Amount field. I want amount values to appear with '$' symbol for which I declared Amount column with type 'Currency' but I was not ...
0
votes
1answer
46 views

How to sort fields of an object related to another object

Sorting fields directly from an object works, but how to sort fields from a related object? How do you access the Description__c field so that you can sort the records? Controller @AuraEnabled public ...
0
votes
0answers
15 views

Sorting multiple times in Aura lighting table gives me error - Uncaught (in promise) TypeError: Cannot set property 'rowIndex' of undefined

Hiall! I am not sure whats causing this issue- I have a datatable with sort. It works fine the first time but when I click on Sort arrow a couple times, I start seeing this error in console and the ...
2
votes
2answers
93 views

Efficiently sorting a list of Work Order records by a Sequence

I have Work_Order_Sequence__c and UniqueKey__c field on Work Order object. In my method I wish to create a Map which has a Key => UniqueKey__c and Value=> List<WorkOrder> (sorted). ...
0
votes
1answer
334 views

LWC lightning data table not showing vertical scrollbar and 'sortable' not sorting - what am I doing wrong?

I have a component with a Lightning-data-table but I can't get the vertical scrollbar to show up and although, when I add 'sortable' to a column, the arrow appears but nothing happens when I click the ...
0
votes
2answers
99 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
36 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
93 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
466 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
84 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
480 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
38 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
147 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
144 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
299 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
1k 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
77 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
953 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
4k 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
385 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
525 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
234 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
486 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
943 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
774 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
29 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
225 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
170 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 that ...
1
vote
2answers
326 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
2k 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
191 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
387 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
846 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
137 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
304 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
796 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. ...
8
votes
1answer
6k 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
2k 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 ...