Questions tagged [sort]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
32 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)...
user avatar
  • 35
-2 votes
1 answer
216 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', ...
user avatar
0 votes
1 answer
47 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 ...
user avatar
-2 votes
1 answer
31 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 ...
user avatar
  • 95
-2 votes
2 answers
50 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 ...
user avatar
0 votes
1 answer
82 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 ...
user avatar
0 votes
0 answers
305 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,...
user avatar
1 vote
2 answers
340 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 ...
user avatar
  • 15
0 votes
1 answer
146 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 ...
user avatar
  • 203
1 vote
1 answer
167 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 ...
user avatar
0 votes
1 answer
34 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 ...
user avatar
  • 431
0 votes
1 answer
72 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&...
user avatar
0 votes
1 answer
98 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 ...
user avatar
0 votes
1 answer
171 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 ...
user avatar
0 votes
1 answer
196 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={...
user avatar
  • 1,443
1 vote
1 answer
148 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')...
user avatar
0 votes
1 answer
2k 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
user avatar
  • 1
0 votes
1 answer
418 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 ...
user avatar
0 votes
1 answer
271 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 ...
user avatar
0 votes
0 answers
17 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(...
user avatar
  • 41
0 votes
3 answers
182 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} ...
user avatar
  • 25
9 votes
1 answer
84 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 ...
user avatar
  • 33.6k
0 votes
1 answer
258 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 ...
user avatar
  • 1
3 votes
1 answer
742 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 ...
user avatar
  • 1,377
0 votes
1 answer
511 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 ...
user avatar
-1 votes
1 answer
34 views

List Order by number value [closed]

i convert json to list: [ { name: "file.png", time: 1600813341124345 }, { name: "file2.png", time: ...
user avatar
  • 125
0 votes
0 answers
67 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 ...
user avatar
  • 1,159
0 votes
2 answers
3k 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 :...
user avatar
0 votes
1 answer
797 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 ...
user avatar
0 votes
1 answer
107 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 ...
user avatar
1 vote
0 answers
76 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 ...
user avatar
  • 69
3 votes
2 answers
296 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). ...
user avatar
  • 4,521
0 votes
1 answer
2k 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 ...
user avatar
  • 1,377
0 votes
2 answers
370 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 ...
user avatar
1 vote
1 answer
138 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, ...
user avatar
  • 471
2 votes
1 answer
172 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 ...
user avatar
  • 33
0 votes
2 answers
1k 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 ...
user avatar
2 votes
1 answer
136 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....
user avatar
  • 75
0 votes
1 answer
980 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 ...
user avatar
  • 75
1 vote
0 answers
43 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 ...
user avatar
1 vote
2 answers
321 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 ...
user avatar
  • 541
0 votes
0 answers
59 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 ...
user avatar
0 votes
1 answer
339 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 ...
user avatar
  • 93
0 votes
0 answers
407 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. ...
user avatar
3 votes
1 answer
2k 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 ...
user avatar
0 votes
1 answer
168 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 ...
user avatar
1 vote
1 answer
1k 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 ...
user avatar
  • 367
1 vote
3 answers
7k 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<...
user avatar
0 votes
2 answers
583 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(...
user avatar
6 votes
2 answers
927 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 ...
user avatar
  • 645