Questions tagged [sort]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
19 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 ...
0
votes
0answers
35 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,...
1
vote
2answers
293 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 ...
0
votes
1answer
46 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 ...
1
vote
1answer
70 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 ...
0
votes
1answer
27 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 ...
0
votes
1answer
39 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&...
0
votes
1answer
48 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 ...
0
votes
1answer
87 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 ...
0
votes
1answer
46 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={...
1
vote
1answer
107 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')...
0
votes
1answer
651 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
0
votes
1answer
178 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
181 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
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(...
0
votes
3answers
67 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
81 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
155 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
513 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
318 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
34 views

List Order by number value [closed]

i convert json to list: [ { name: "file.png", time: 1600813341124345 }, { name: "file2.png", time: ...
0
votes
0answers
37 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
2k 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
627 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
78 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 ...
1
vote
0answers
47 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 ...
3
votes
2answers
205 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
1k 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
246 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
70 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
122 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
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 ...
2
votes
1answer
114 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
864 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
40 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
255 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
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 ...
0
votes
1answer
272 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
397 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
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 ...
0
votes
1answer
123 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
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 ...
1
vote
3answers
6k 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
2answers
530 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
827 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
335 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
580 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
1k 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
959 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
41 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 ...