Questions tagged [sort]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-2 votes
0 answers
34 views

Need the logic of Sorting from parent to child component

I have a parent component "ProductSearch" with Child Component "ProductTile" I need the sorting on the basis of material_id_mvke_matnr PARENT CODE == <aura:if isTrue="{!...
VAIBHAV SRIVASTAVA's user avatar
-2 votes
1 answer
42 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
  • 835
-1 votes
0 answers
27 views

Update order field in all sobject records via batch

I have a requirement that each day I have to retrieve all records from an org and sort them (storing the new index) based on some previously defined criteria. My issue with this is that I'm not sure ...
molinet's user avatar
  • 835
0 votes
0 answers
169 views

Sort Related List rows (of LWC) normally, Alphabetically and by price

I am trying to sort the rows of my realted list. First I was using a standard sort function but it was not sorting the prices correctly. Ex; it was setting $117,000 lower than $68 000 because 1 is ...
Pierre-Olivier Thibault's user avatar
-2 votes
1 answer
30 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
85 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
126 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
  • 15.8k
1 vote
1 answer
110 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,391
1 vote
2 answers
557 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
637 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
263 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
1k 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
585 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
49 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
  • 105
-2 votes
2 answers
289 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
852 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
2k 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
863 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
591 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
  • 223
1 vote
1 answer
699 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
64 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
  • 451
0 votes
1 answer
318 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
457 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 ...
parsa_047Fletcher's user avatar
0 votes
1 answer
417 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
801 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,587
1 vote
1 answer
318 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
4k 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
3k 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
516 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
19 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
823 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
169 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.2k
0 votes
1 answer
559 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
1k 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,703
0 votes
1 answer
1k 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
104 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
269 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,359
0 votes
3 answers
6k 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
1k 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
248 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
122 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
660 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,751
0 votes
1 answer
3k 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,703
0 votes
2 answers
876 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
308 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
  • 521
2 votes
1 answer
445 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
192 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
  • 87
0 votes
1 answer
1k 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
  • 87