How to sort a collection by two componets/Attributes

Hello All,
Scenario:
I have a result table view with columns Contact Person Number, Central Block flag and Last name. At the instance of BP confirmation in IC this result table(result view displays the contact persons associated with the account id during the BP cofirmation) is filled in a sorted order based on the Contact Person Number.
Requirement:
Sort the result table by Central block flag followed by Contact Last Name.Hence how to sort the collection of the result table view based on two attributes Central Block and Last Name?
Looking forward for your support.
Regards,
Harish P M

Hello Harish,
Good question. The framework doesn't seem to support this. When i needed this functionality, i had to create my own implementation of collection. You can inherit from CL_CRM_BOL_ENTITY_COL and overwrite several methods which do the sorting. Check the class CL_CRM_IPM_RAA_BOL_COL.
Best Regards,
Yevgen

Similar Messages

  • How to sort a collection based on their date?

    how do i sort a collection based on their respective dates which are in Calendar format?

    this is my codes
    /** This class is use to sort the call list base on their date
    import java.util.*;
    public class a implements Comparator
         /** compare the objects base on their types
         *     @obj1 the first object to be compared
         *     @obj2 the second object to compare with the first object
         public int compare(Object obj1, Object obj2)
         if (obj1 == obj2)
              return 0;
         if (obj1 == null || obj2 == null)
              return 0;
         if (!(obj1 instanceof Call) || !(obj2 instanceof Call))
              return 0;
         Call lhs = (Call) obj1;
         Call rhs = (Call) obj2;
         int s = lhs.getDate().compareTo(rhs.getDate());
         if (s != 0)     
              return s;
         return 1;
    this is the error
    a.java:21: cannot resolve symbol
    symbol : method compareTo (java.util.Calendar)
    location: class java.util.Calendar
         int s = lhs.getDate().compareTo(rhs.getDate());

  • How to use same collection on two forms

    Hi ,
    My issue scenerio is--
    I have two forms one is calling form other is call form. User will go to calling form and press button to open call form. In call form user will select some records. That records i want to store in collection. then user will close call form , and on calling form i want to use those collection values.
    For this i did some coding like
    I created a type in database , then I created a record type in which i stored selected records information. I can see that values have been properly stored in collection till i exit call form.
    Once i am back on calling form it becomes null.
    Please help..
    Regards,
    Kuldeep

    *Before posting on this forum please read*
    >
    I can see that values have been properly stored in collection till i exit call form.
    Once i am back on calling form it becomes null.Hi,
    Do you perform commit_form or commit when/before exit call form ?
    Hope this helps
    If someone's response is helpful or correct, please mark it accordingly.

  • How do I synchronize data collection on two DT3001 boards?

    I am very new to Labview, and I am trying to find an easy way to synchronize my data collection on two DT3001 boards.  I have tried modifying the AI Continuous Scan example.  This works because I am using all 16 channels on each of my boards.  Unfortunately, I cannot find a way to make both boards collect data beginning at the same time.  Is there an easy way to synchronize both boards to collect data at the same time?  Thank you for your help!

    Hello Kacie,
    I'm not sure how your DT 3001 device and it's drivers LabVIEW functions work, but for synchronizing acquisition on two National Instruments DAQ cards, you need to share a start trigger and sample clock between the two cards by connecting the Real-Time System Integration (RTSI) buses of the cards using a RTSI cable.  This provides dedicated lines for sharing the same sample clock and start trigger, and provides highly accurate hardware-timed synchronization.  Any synchronized starting you program in software in LabVIEW will be software timed.  You can use the sequence structure within LabVIEW to group together different portions of code so that all the configuration is performed for both cards first, and then they are started at the same time.  I know this probably isn't too much help, but I would need to know more about how your DT 3001 device and the AI Continuous Scan example works.  You might be able to find better help on this at Data Translation's website.
    Travis G.
    Applications Engineering
    National Instruments
    www.ni.com/support

  • How can I sort a collection of array with different object types in it ?

    Hi all,
    I have a collection of ArrayList; each array contains, at the first position, the same object type.
    I'd like sorting the collection by the name contained in the object at the first position of each array.
    Any suggestion ?
    Cheers.
    Stefano

    so you have a collection of a collection?
    My guess is that:
    You could subclass the arraylist and override it's compareTo method (I think that it implements comparable already but if not, go ahead and implement that interface).
    Or you could wrap your arraylist in another class that implements comparable.
    The key in my mind is correctly coding your compareTo method to look at the name in the first item of the arraylists. This should be doable and not too difficult.
    Correction: after reviewing the ArrayList api, I see that it doesn't implement the Comparable interface. You will have to make any class that either inherits arraylist or contains arraylist implement the comparable interface.
    One last thing: This question would probably have been better off in the java forum and not the Swing forum since it doesn't really involve Swing.
    Good luck!
    Edited by: petes1234 on Nov 19, 2007 6:17 AM

  • How to sort the data in JSP using stylesheet sorting?

    Hi, i extracted data out in and display them <%=data%> in the jsp, but how to sort? do i have to provide a drop down list that gives different sorting options, and when user clicks on one option, say sort by title, the collection of results are sorted out on the same jsp page? so all in all, only one jsp page is needed or do i need to create xml files, etc?
    i have no idea how to integrate the xml sorting into the jsp page, even after seeing online help, cos there is no example of a jsp page with sorting to refer to. PLease help, thanks alot!

    im getting the data from beans, but one of the requirements was that i cant use the database to sort and display but i have to use xslt to do the sorting in the jsps, so i have no idea how to do so. possible to give an example? thanks

  • My screen load times have slowed down to a crawl. I have to wait and wait for a page to load. (I know --dial -up) It used to be much faster a month ago before 5.0. Is it FireFox or do I look to Yahoo for the problem? I don't know how to sort it out.

    I use dial-up, FireFox 5.0, Yahoo addition 1.8. My screen load times have slowed down to a crawl. I have to wait and wait for a page to load. (I know --dial -up) It used to be much faster a month ago before 5.0. Is it FireFox or do I look to Yahoo for the problem? I don't know how to sort it out. Using Vista

    I'm having the same problem. Dreamweaver is supper slow. Uploading and downloads from the server... any server I use two different servers. It times out all the time. Menus are slow too.
    I'm on a MAC Pro, 6 gigs of ram no issues with anything else. I have talked to Apple they have checked everything for me. They say it's Dreamweaver. I've noticed the Dreamweaver is talking to the FTP even when I'm not doing anything.
    I've tried cleaning out my MAC caches, turning off file check and check out. Still really slow. I've worked with Dreamweaver for 6 years never any issues like this before. 18 seconds to upload a 4 kb file. 11 seconds to download the same file.

  • How to sort via multi value parameter in ssrs

    I have a parameter with multi values. when the user selects ,he get of options like acount name, first name, last name.
    so if user selects firstname , the data has to sort by firstname.
    if he selects acount name , the data has to sort by account name.
    please help me how to sort the data using parameter with multivalue? in ssrs 2008.
    Thank you?

    Hi Venku,
    Based on your description, it seems that you create a parameter with available values and you want to sort the report data based on the parameter value. If the available values are the field names in the report, you can try to open the Tablix properties
    dialog box and specify the sort expression on "Sorting" tab as follows:
    =Fields(Parameter!parametername.value).value
    If the parameter allow multiple values and you want to sort the report data by more than one field, for example, sort the report data by "accountname" and then by "firstname", please add two sort expressions as follows:
    =Fields(Parameter!parametername.value(0)).value
    =Fields(Parameter!parametername.value(1)).value
    If you have any question, please let me know.
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • How to Sort JTable data using Multiple fields (Date, time and string)

    I have to fill the JTable data with some date, time and string values. for example my table data looks like this:
    "1998/12/14","15:14:38","Unicorn1","row1"
    "1998/12/14","15:14:39","Unicorn2","row2"
    "1998/12/14","15:14:40","Unicorn4","row3"
    "1998/12/17","12:14:12","Unicorn4","row6"
    Now the Sorted Table should be in the following way:
    "1998/12/17","12:14:12","Unicorn4","row6"
    "1998/12/14","15:14:40","Unicorn4","row3"
    "1998/12/14","15:14:39","Unicorn2","row2"
    "1998/12/14","15:14:38","Unicorn1","row1"
    ie First Date field should be sorted, if 2 date fields are same then sort based on time. if date and time fields are same then need to be sorted on String field.
    So if any one worked on this please throw some light on how to proceed. I know how to sort based on single column.
    But now i need to sort on multiple columns.So what is code change in the Comparater class.
    Thanks in advance.. This is urgent....

    I think your Schedule objects should implement Comparable. Then you can sort your linked list using the Collections.sort() method without passing in a Comparator.class Schedule(Date date, String class) implements Comparable
      public void compareTo(Object obj)
        Schedule other = (Schedule)obj;
        return date.getTime() - other.getDate().getTime();
    }

  • How to use a collection in ADF

    Hi all,
    How to use the collection in ADF.
    Thanks in advance
    C.Karukkuvel

    hi John,
    Scenario:
    In my page,i have two tab pages .In that when the user enter the Location names in the first tab.when the user navigates to the next tab,we need to give the LOV having the Loactions based on the first tab values.
    when i try to use the view object it will list only the data's in the database.but i needs the locations entered in the current page also.pls guide me in this
    Thanks & Regards
    C.Karukkuvel

  • How to compare the contents of two different tables

    hello. can somebody give me an idean on how to compare the contents of two different tables in mysql?
    example, i have a table named Main List and a table named New List.
    The contents of the New List should be compared to the contents of the
    Main List, to check if they are equal. I don't have any idea how to manipulate
    this data. Hoping for your help. Thanks.

    it is better to comapre it using java.. try get the resultset first and store that in collections then comapre the two collections

  • How to sort a list of strings, without methods and stuff just simple code?

    Hi
    How to sort a list of strings, without methods and stuff just simple code?
    Thanks in adavance!!

    Without methods? How are you going to all the sort code? What is the point of code?
    Collections.sort(List) will sort strings or anything that implements the Comparable interface, or you can use the sort method that takes a Comparator implemenation.
    If you want "just code", you could either get the Collections class souce and follow it to the code. But otherwise, there isn't one set of code. There are various sorting algorithms with advantages and disadvantages. Maybe you'd be better off searching for sorting algorithms and if you understand them, it should be simple to write Java implementations of them.

  • How to sort a 2 dim. array by the first column?

    Hi there,
    I need to know, how to sort a 2 dim. String array by the first column, which means "string[0][x]".
    I think, I have to implement a new comparator class. But how?
    Thanks in advance for any help

    I need to know, how to sort a 2 dim. String
    array by the first column, which means
    "string[0][x]".You want to sort the array using the first element in each row and that element is a String?
    Let's forget about generics. Say you want to supply a Comparator. The compare method should decide the order between elements when passed two element objects. In a two-dimensional array the elements will be one-dimentional arrays and you use the first element in those arrays, like
    public int compare(Object s1, Object s2) {
       String[] a1 = (String[]) s1;  // first row array
       String[] a2 = (String[]) s2;  // second row array
       return a1[0].compareTo(a2[0]); // compare first element of row arrays
    }

  • How to sort multiple t:dataTable columns with Tomahawk?

    Hello, I'm using Tomahawk with MyFaces and I'm trying to sort my table by couple of columns. I have year and month cols and when I sort by year and two years are equal, I want to subsort by the months. I actually tried to create a sort method taking sortColumn and ascending as params, but it didn't get invoked by the app. I also tried to put commandButton as headers which call sort(ActionEvent), but it still didn't get invoked. May anyone show me how could I write a backend for the sorting?
    Thanks in advance!
    Regards,
    Mario

    Yes, there is a comparator. I don't find the problem so much TOmahawk specific, I'm actually trying to solve it without it too. But I found where the problem is - in the <t:column> tag - when sortable attribute is enabled, it doesn't call any external methods, no matter if they are actions or actionListeners.
    So when I removed the sortable attribute, my backend method got called. :)
    Regards,
    Mario

  • How to Sort I variable of type VariableOneToOneMapping

    I am having a object mapping like this
    interface IUserName {
    public String getUserName();
    This method will be implemented by two class say A & B,Both the implementation looks like this
    class A implements IUserName {
    String name;
    public String getUserName() {
    return name;
    public void setUserName(String na) {
    name = nm;
    class c {
    ValueHolderInterface name= new ValueHolder();
    public IUserName getName(){
    return (IUserName ) name.getValue();
    Similarly the Class B also has the same implementation.The variable name in Cis mapped as VariableOneToOneMapping .i.e, name is mapped to Interface IUserName.
    Please let me know how to sort this expression name in the class C.
    I tried this
    ExpressionBuilder eb = new ExpressionBuilder()
    Expression exp = eb.get("name").get("name").ascending();
    ReadAllQuery ra = new ReadAllQuery(c.class);
    ra.setOrderByExpressions(exp);
    But I am getting the exception like this ----->
    (ERROR) Exception thrown while executing query. EXCEPTION [TOPLINK-6072] (TopLink - 9.0.3.5 (Build 436)): oracle.toplink.exceptions.QueryException EXCEPTION DESCRIPTION: Querying across a VariableOneToOneMapping is not supported.
    Please let me know how to overcome this issue.

    It is not possible to perform a joining query across a variable class 1:1 mapping. If you need this sort of querying I would recommend using a shared table between your interface implementers and inheritance. Then you can have a relationship to the root class and query on the shared attributes.
    Doug

Maybe you are looking for