Skip to main content

Questions tagged [sort]

The tag has no usage guidance.

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

How to merge objects in query?

I have 2 custom objects. Let's say its customObj1__c and customObj2__c. List<customObj1__c> obj1 = [SELECT Id, Name__c, Age__c FROM customObj1__c ORDER BY CreatedDate ASC]; List<customObj2__c&...
Saber's user avatar
  • 1
0 votes
0 answers
17 views

Sort Element - Can it work with/as a variable from GET to UPDATE

Situation. We are tidying up some flows so they use less GET's. We have one that gets a single highest value of the last 6 months. Previously we had a filter (for its requirements) then a descending ...
Stephen John cook's user avatar
-2 votes
1 answer
168 views

Sort List by multiple criteria

I have a requirement that I need to sort a list of records by multiple criteria but only proceed to the following sorting criteria if there're still duplicates: Example: First sort by Type and if ...
molinet's user avatar
  • 925
-2 votes
1 answer
251 views

Sort Records and Assign Sorting Number - Joint Salutation

I have the following use case: We would like to create a joint letter salutation for the contacts which are related to an account. For example Dear Mr. Smith, Dear Mrs Smith. Because we want to create ...
Jan's user avatar
  • 1
1 vote
1 answer
238 views

Do indexed fields guarantee sort optimisation?

I have an Apex Action that queries records of a custom object called Payable__c. This object has a look-up field called InvoiceId__c. The Apex Action needs to sort Payable__c records according to the ...
user51462's user avatar
  • 115
2 votes
1 answer
139 views

Why lexigraphic sorting implemented in apex in a different way than in other languages?

When I try to compare strings in Apex, for example '1a' < '-a', this statement returns true while in other languages, like Javascript, '1a' < '-a' is returning false. However, '2a' is bigger ...
Patlatus's user avatar
  • 17.4k
1 vote
1 answer
277 views

Nested Compareable Methods on Wrapper Class

I have a wrapper of Tasks and Events that I want to sort by: ActivityDate then by LastModifiedDate then by CreatedDate (all in descending order) My initial thought was to do the comparable interface ...
Olivia's user avatar
  • 3,471
1 vote
2 answers
1k views

Sort lightning datatable by default

My sort function works fine, but I the table should be sorted by default. How can I sort the table by date (dateOut) by default? CONTROLLER doInIt : function(component, event, helper) { component....
FenTro's user avatar
  • 29
0 votes
1 answer
1k views

LWC Totals Row in Data Table won't push

I have a LWC with a Lightning data table working and I have a search and a sort function that works as well. When the data comes from the wrapper class in the apex controller it works fine and there ...
Matthew Huston's user avatar
0 votes
0 answers
2k views

How do I filter data related to selected field box in my lightning data table in LWC

Hello Guys._ Guys, I have an issue with my lightning datatable Current table The problem is when I want to show the data with the current broker selected, for example, if I select "Accurate ...
Alex Barón's user avatar
0 votes
0 answers
359 views

Finding the max of value of Map<id, sObject> based on custom field

I am trying to find the biggest record in the Map for each iteration. The sorting should be based on the custom field X. After finding the biggest record, I should increment one of its fields (Y field)...
Argen Turatbek's user avatar
-2 votes
1 answer
2k views

How to Sort Date in LWC Data table in DD.MM.YYYY Format?

I used below snippet to display Date in DD.MM.YYYY format in lwc datatable { label: DateofClosure , fieldName: 'ClosedDate', sortable: 'true', hideDefaultActions: 'true', ...
SFDCLearner's user avatar
0 votes
1 answer
875 views

Lightning icon inside a tag not working properly

I have used html table to show list of records with custom pagination and sorting in lwc component. For sorting, I need to have up and down button along with text on headers.(Clicking on header text ...
Pankaj Andhale's user avatar
-2 votes
1 answer
60 views

Sortable and Filterable java script for visualforce table [closed]

I have a visualforce page which displays the activities (events, tasks, notes, files) from a account in a table. Some accounts have a huge number of activities and it would be comfortable to sort or ...
Rag21's user avatar
  • 115
-3 votes
2 answers
446 views

Convert Contact List to upperCase in Aura [closed]

I've a below code to sort the contact list without case insencitive. Code: List<Contact> contacts = new List<Contact>(); { contacts = [Select id,Name from Contact where ...
blackFire's user avatar
0 votes
1 answer
1k views

How to create and call a JS function from another LWC?

I want to create a utility class that has this two methods for order a datatable column: function sortBy(field, reverse, primer) { const key = primer ? function (x) { return ...
Alexia Ribeiro's user avatar
0 votes
1 answer
3k views

LWC datatable sorting

I'm trying to create a utility class to do all the sorting for lightning datatable. I used the functions that I have on lightning component and change to LWC, like this: updateSorting(event, fieldName,...
Alexia Ribeiro's user avatar
1 vote
2 answers
2k views

Is it possible to sort this SOQL statement in one query?

I have a list of records with name fields that all contain something like 'Name1', 'Name2, ..., 'Name20'. It's also not guaranteed that there will be a complete list of 1-20, i.e. it can be a list of ...
conejo's user avatar
  • 15
0 votes
1 answer
845 views

Efficient ways to manually rank records

I've received a request for staff to manually rank their top prospects for soliciting donations (a mix of Contacts and Accounts) so that when they meet periodically with their supervisor they can ...
kd7iwp's user avatar
  • 243
1 vote
1 answer
1k views

Force capital letters in a lightning-input element

Is there any way to capitalize the letters from a lightning-input (type text) in html? I'm using this in a lightning-datatable and when a use insert a lowercase field, it's sorted before the capital ...
blanco17's user avatar
0 votes
1 answer
74 views

List does not return my manual field and how can I sort the list

I want to create a list of tasks, events, files and notes, so the sales man have just one list for all activities. The list works, but I still have a few questions. I add to each list a manual field ...
peXeq's user avatar
  • 471
0 votes
1 answer
418 views

How can I order the Fields of the Custom Settings with Sort() method?

This is the method @AuraEnabled public static list<documentEntity> GetDocumentsInfo(){ try{ List<DocumentType__c> documentList = DocumentType__c.getall().values(); list&...
Willy Kelly's user avatar
0 votes
1 answer
625 views

Wrong Opportunity Stage Order in Report

A report I made is showing the wrong opportunity stage order. For example, "Complete" should be the final stage and it should be followed by "Arrival". The order is correct in the ...
Doodool_Tala's user avatar
0 votes
1 answer
546 views

ignore a specific row when sorting in lightning-datatable

So, I'm displaying some information on a lightning-datatable. The last two columns, show two different kind of prices, so for each page in the datatable, I add a last row at the end to show to total ...
joacoiudica's user avatar
2 votes
1 answer
1k views

Datatable sorting stops working after two attempts

I have a URL field on a datatable: <lightning-datatable key-field="id" data={data} columns={columns} onrowaction={handleRowAction} sorted-by={...
Json's user avatar
  • 1,667
1 vote
1 answer
432 views

Why is the sort pointer in the lightning datatable always pointing downwards in my case?

Here is the code for my sorting method and it works great: sort : function(component, event, helper) { let sortedBy = event.getParam('fieldName'); let sortedField = (component.get('v.sortedBy')...
unique user's user avatar
0 votes
1 answer
8k views

Sort the list values based on Created Date [duplicate]

List<Account> Acc// this list contains Account records. Acc.Sort() is not working How to sort the records based on Created Date? Basically i need the recently record from the Acc list
Ram's user avatar
  • 1
0 votes
1 answer
5k 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 ...
Krishnamurthy's user avatar
0 votes
1 answer
616 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 ...
Krishnamurthy's user avatar
0 votes
0 answers
20 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(...
mSinisa's user avatar
  • 51
0 votes
3 answers
1k 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} ...
MehSF's user avatar
  • 35
5 votes
1 answer
204 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 ...
Uwe Heim's user avatar
  • 28.5k
0 votes
1 answer
660 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 ...
ab02's user avatar
  • 1
3 votes
1 answer
2k 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 ...
Irene's user avatar
  • 1,851
0 votes
1 answer
2k 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 ...
Gaurav Sharma's user avatar
-1 votes
1 answer
235 views

List Order by number value [closed]

i convert json to list: [ { name: "file.png", time: 1600813341124345 }, { name: "file2.png", time: ...
pedroooo's user avatar
  • 125
0 votes
0 answers
409 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 ...
Andy Ray's user avatar
  • 1,488
0 votes
4 answers
7k 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 :...
Gaurav Sharma's user avatar
0 votes
1 answer
2k 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 ...
Gaurav Sharma's user avatar
0 votes
1 answer
328 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 ...
Алёна Опарина's user avatar
1 vote
0 answers
128 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 ...
P.Shri's user avatar
  • 69
4 votes
2 answers
924 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). ...
SfdcBat's user avatar
  • 4,839
0 votes
1 answer
4k 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 ...
Irene's user avatar
  • 1,851
0 votes
2 answers
1k 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 ...
Ajith Kumar's user avatar
1 vote
1 answer
481 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, ...
kratos's user avatar
  • 541
2 votes
1 answer
591 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 ...
Bala's user avatar
  • 33
0 votes
2 answers
3k 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 ...
Mar Andrés López's user avatar
2 votes
1 answer
207 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....
Trace's user avatar
  • 127
0 votes
1 answer
2k 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 ...
Trace's user avatar
  • 127
1 vote
0 answers
54 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 ...
Pedro Van's user avatar