Sorting in numbers using a predefined order.

I've seen this question posted, but without a solution beyond, send it to tech support for a suggestion.  That being said, I'm reposting to see if anyone has come up with something.
Let's say I have this table:
Fruit
Name
Banana
Joe
Apple
Brittany
Orange
Scott
Banana
Ted
Apple
Molly
I want to PREDEFINE the sorting order:
Orange
Apple
Banana
Then I want to sort that way.  Sorting by Categories IS NOT how I want this to happen.
Can this happen?  How does this happen?

Mike,
Add a column, Hidden if you prefer, and in that new column enter letters or numbers to define the preferred sort order. When it comes time to sort, use that column. You may need a different sort order defining column for each list that you want to define an order for.
Jerry

Similar Messages

  • Java Comparator - Sorting - using predefined order

    I want to sort the items in my list with a predefined order....Is it possible? I can sort my List using a natural sort as in the below example. But that is not am looking for.....Am looking for sorting my list using an already defined order which i can hold using another list. IS IT POSSIBLE USING Comparator
    package com.nationwide.ag.integration.adapter.party;
    import java.util.*;
    public class TestUsingMe {
    static class AppComparator implements
    Comparator {
    public int compare(Object o1, Object o2) {
    int cc = ((Integer)o1).compareTo(o2);
    return (cc < 0 ? 1 : cc > 0 ? -1 : 0);
    static Comparator appcomparator =
    new AppComparator();
    static void sort(List list1) {
    Collections.sort(list1, appcomparator);
    public static void main(String[] args) {
    List list1 = new ArrayList();
    list1.add(new Integer(90));
    list1.add(new Integer(43));
    list1.add(new Integer(21));
    sort(list1);
    System.out.println(list1);
    Please reply................

    Tried as per your advice, as below. But, it didn't work out. (Hope I have done the changes correctly). Please find the changed code below:
    import java.util.*;
    import com.dto.search.PersonDTO;
    public class TestUsingMe {
    public static void main(String[] args) {
         PersonDTO pDTO0 = new PersonDTO();
         pDTO0.setCifId("Named Non-Owner");
         PersonDTO pDTO1 = new PersonDTO();
         pDTO1.setCifId("Restored");
         PersonDTO pDTO2 = new PersonDTO();
         pDTO2.setCifId("Antique/Classic");
    List list1 = new ArrayList();
    list1.add(pDTO0);
    list1.add(pDTO1);
    list1.add(pDTO2);
    List list2 = new ArrayList();
    list2.add("Private Passenger");
    list2.add("Restored");
    list2.add("Antique/Classic");
    list2.add("Named Non-Owner");
    list2.add("Trailer");
    AppComparator appcomparator = new AppComparator(list2);
    Collections.sort(list1, appcomparator);
    static class AppComparator implements Comparator {
    private List list;
    public AppComparator(List list) {
    this.list = list;
    public int compare(Object o1, Object o2) {
    return list.indexOf("cifId") - list.indexOf("cifId");
    Please respond...................

  • Sorting character column ( used in order by clause dynamically)

    Hi,
    I need help on sorting character-based numbers. Like say, I want to sort customers based on street numbers(which is a character string being used in the
    order by clause) they live in.
    The criteria are :
    i. Numbers must take precedence.
    This being a character string, 1000001 comes before 2. This shouldn't happen. And you cannot use to_number
    since using it with a string having characters in it would raise an error.
    ii. If only a single alphabet occurs as the last character, then treat the whole string as a number except the last character and then sort it
    as if sorting a number. Something like : if you have 1000A, 200D, 200B, 1000X, the result would be 200B,200D,1000A,1000X.
    iii. if a character occurs elsewhere in the string, then perform the search normally as if performing a character search.
    The output of the following data :
    100
    A101
    B100A
    110C
    C120B
    120
    100020
    120C
    C1100
    100D
    would be like :
    100
    100D
    110C
    120
    120C
    100020
    A101
    B100A
    C120B
    C1100
    Please note that the sort is being done dynamically, so I could have access to the values of the street numbers only during run time.
    Any help is really appreciated.
    Thanks in advance.
    Regards,
    Anil.

    Create a function to test whether the column is numeric :
    create FUNCTION is_numeric(v_number VARCHAR2)
    RETURN INTEGER
    IS
    l_number NUMBER;
    BEGIN
    IF INSTR(UPPER(v_number),'E') > 0 THEN
    RETURN 0;
    END IF;
    l_number := TO_NUMBER(v_number);
    RETURN 1;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN 0;
    END;
    And try this query
    Assume the table name is TEST with column STREET
    select * from TEST
    order by case is_numeric(STREET) when 1 then LPAD(STREET,20, ' ') else STREET end
    Please make sure that 20 mentioned above is the column size for STREET.
    Hope this helps.
    -Nags

  • How can I sort a table using more than one column in Numbers or in Pages?

    How can I sort a table using more than one column in Numbers or in Pages?

    Hi Ron,
    On the right side of the Toolbar click the Sort and Filter button, then select Sort.
    You can then set up a multiple column sort.
    Click Add A Column, Specify the sort for that column, Repeat.
    Jerry

  • Sort selected rows using Numbers on an iPad

    I am new to Numbers.  I have spreedsheets in iCloud.  On my MacBook I have figured out how to sort just "selected rows", but have not been as lucky on the same spreedsheet accessed on my iPad.  If I select the rows on Numbers on the iPad the "sort" option does not appear.  If I hit the block above the column it will ask how you want to sort, but this sorts the whole table/spreedsheet.  Is there a way in Numbers using an iPad where you can just "sort selected rows", like on the MacBook?

    Sort is only available for columns in Pages for iOS.

  • Sorting numbers using itab(urgent)

    hi,
       i want to sort the number using itab. i am writting the code as follows. but i am not getting itab sorted asending? pl. tell me why????
    Data: itab2 type table of string with header line.
    if IT_BOM1-LABST < IT_BOM1-MENGE.
      ITAB2 = MIN.
      append itab2.
      ELSE.
      itab2 = w_shortb.
      append itab2.
      ENDIF.
    if itab2[] is not initial.
        sort itab2 ascending.
      endif.
      read table itab2 index 1.
      If sy-subrc = 0.
      Write:/ 'The minimum batch is', itab2.
      endif.
      numb = itab2.
    write :/ numb.
    when i am debugging then itab not showing sorted in ascending

    Hi Samir,
    what about a slim solution?
    data:
      lt_mng type sorted table of mard-labst
        with unique key table line,
      lv_menge like line of lt_mng.
    insert:
      IT_BOM1-LABST into table lt_mng,
      IT_BOM1-MENGE into table lt_mng,
      w_shortb into table lt_mng.
    read table lt_mng into lv_mng index 1.
    Write:/ 'The minimum batch is', lv_mng.
    Regards,
    Clemens

  • How to sort  the arry value in ascending order

    I have a string array where i need to sort the below values in ascending order in the same format...can anyone give me clue on this?
    9.3
    3.1
    9.1
    19.1
    19
    9.4
    9.1.1
    the sorted order should be
    3.1
    9.1
    9.1.1
    9.3
    9.4
    19
    19.1

    You may have easier luck writing your own comparator for this. These are headings in a table of contents, right?
    Write a comparator that tokenizes a string on the '.' character, or use a StringBuffer to remove them, and then order the elements according to the combined numbers. Since alphanumeric would order this list as you want it anyway you could just order that way once the '.' are removed.
    In other words your comparator would do this in the "compare" method:
    public class MyComparator implements Comparator, java.io.Serializable {
    private static Comparator stringComparator = java.text.Collator.getInstance();
    ...constructor(s), your own private "instance" variable of type MyComparator, a getInstance() method of your own, yadda yadda...
    public int compare(Object item1, Object item2) {
    try {
    value1 = removePeriods((String)item1);
    value2 = removePeriods((String)item2);
    if (value1 == null) {
    return (value2 == null) ? 0 : (-1);
    return compare(value1, value2);
    } catch (ClassCastException cce) {
    System.err.println("Wrong Object Type, JackAss!");
    protected int compare(String str1, String str2) {
    return MyComparator.stringComparator.compare(str1, str2);
    private String removePeriods(String value) {
    StringBuffer sb = new StringBuffer(value);
    int decimalIndex = value.indexOf('.');
    while (decimalIndex != -1) {
    sb.delete(decimalIndex, (decimalIndex + 1));
    }

  • Task Line Numbers Move Out of Order When Adding Resource to a Task

    I am using MS Project 2013 and we are in the process of setting up Project Server 2013. 
    When I add a resource to a task and close the summary task and re-open the task is moved to the bottom of that section and the line numbers are out of order.
    For example line number 382 is the third task under the summary task.  When I add a resource, hide the subtasks and then expand the subtasks line number 382 is now at the bottom after line 389.  The line numbers then go 381, 383, 384... until 389
    then 382 is after 389.
    I want to keep the tasks in sequential order.
    Has anyone seen this problem before?  I have done extensive research online and cannot seem to find any one with a similar issue.
    Thank you! :)

    Hi Dnbree,
    Do you have any filters applied to the view in Project Pro? Try to change view and check if you experience the same issue.
    Also check if the view uses a sorting in the view tab of the ribbon, such as sort by resources.
    Hope this helps.
    Guillaume Rouyre - MBA, MCP, MCTS

  • ITunes sorts audiobook chapters in a random order how do I correct this?

    I own a copy of Arkange Complete Shakespeare, I have copied them onto my hard drive and tried to import them into iTunes.  No matter what I do, each track appears in a random order.  I've numbered the tracks like this:
    What I Want ...
    Track #    Name
    41 of 42   30.41 Antony and Cleopatra - Act 5 Scene 1
    42 of 42   30.42 Antony and Cleopatra - Act 5 Scene 2
    01 of 29   31.01 Coriolanus Act 1 - Scene 1
    02 of 29   31.02 Coriolanus Act 1 - Scene 2 ...
    What I get ...
    Track #    Name
    27 of 42   30.27 Antony and Cleopatra - Act 4 Scene 2
    07 of 24   20.07 As You Like It - Act 2 - Scene 4
    24 of 24   20.24 As You Like It - Epilogue
    01 of 29   31.01 Coriolanus Act 1 - Scene 1
    10 of 29   31.10 Coriolanus Act 1 - Scene 10...
    No matter how I try to sort they do not appear in order.  If I manually move each track one at a time into a playlist in the order I wish to listen to it, it will still change the order within the playlist as I make it matching the random order.  For example, if I add Coriolanus Act 1 - Scene 1 first and I then add Coriolanus Act 1 - Scene 2 second when I get to Scene 10 and add it after Scene 9 it will jump from where I put it to the spot imediately after Scene 1 as you see above.  I have tried renumbering the tracks so that each play, act and scene runs in chronological order, but it will still sort it wrong in iTunes.  Is there some hidden metric that I need to change to correct the order?  I have noted that although the sorting is random as I add them to iTunes the random order is the same each time.
    I do not have this sorting order problem in any other audio programs on my PC, but those other audio programs do not synch with my iPod

    See my previous post on Grouping Tracks Into Albums, in particular the topics Use an album friendly view and Tracks out of sequence.
    When you say the songs are listed alphabetically is this when looking at the iPod while connected to iTunes, in the iPods Cover Flow, Album & Artist Menus or within your playlists. If a playlist is showing up in the wrong order, arrange it iTunes the way you want, then right/option-click on the playlist title and click on Copy To Play Order.
    tt2

  • Sort list items according to predifined order

    hi all,
    I wonder is there any way to sort the items of a list
    according to a predefined order (e.g., 2,3,1)?
    Many thanks

    As far as I know the only predefined sort order is
    alphabetic. You could write a function using
    list.addAt(position,value) to add new items in the proper location
    and maintain the sort order yourself. This might involve a lot of
    looping through the target list, depends on how complex your sort
    rules are.
    I had a project where I needed to keep a list of file names
    sorted by rules other than alphabetic. I actually used a big lookup
    table (case statement) to append letters to the beginning of each
    name just before adding them to the list, the letters were stripped
    off when data was retrieved from the list. This trick allowed me to
    use list.sort() to maintain the sort order. It’s an ugly
    solution and I’m not proud of it, but it got the job done.

  • Paying for Skype Premium using a Purchase Order/In...

    Hi,
    Our University would like to pay for a Skype Premium account using a Purchase Order system - i.e. we send out a Purchase Order to Skype, Skype sends an invoice, and we then send payment to Skype.
    Would this be possible, or is there an email address I can use to contact Skype directly about this?
    Thanks,
    Massimo

    I guess you are talking about due date for a billing document.
    There's an FM Determine_Due_date for that. before that you'll have to use FM FI_DOCUMENT_READ with I_AWTYP as VBRK and I_AWREF as Billing Document Number. You will get T_BSEG entry.
      CALL FUNCTION 'FI_DOCUMENT_READ'
       EXPORTING
         i_awtyp           = 'VBRK'
         i_awref           = po_vbeln
       TABLES
         t_bseg            = i_bseg
      SORT i_bseg BY vbeln.
    READ TABLE i_bseg WITH KEY vbeln = 'Billing Document Number'.
      IF sy-subrc IS INITIAL.
        MOVE-CORRESPONDING i_bseg TO wa_faede.
        CALL FUNCTION 'DETERMINE_DUE_DATE'
             EXPORTING
                  i_faede                    = wa_faede
             IMPORTING
                  e_faede                    = wa_faede
             EXCEPTIONS
                  account_type_not_supported = 1
                  OTHERS                     = 2.
    This wa_faede will have due date in one of its fields.
    Hey do reward points if this post is helpful.

  • Sort images by 'USED" or "UNUSED" - HOW?

    When assembling large books it seems not possible to sort by 'used images' in order to see what is still available without doubling images. Yes, the used images get a little number un the top left corner, but what about the poor unused images lost in the middle of the stack? Not easy to spot within 200 images... Of course one can do it manually, for instance by using 'rating' as a reference for 'used image' and then display all images by rating.
    Does anyone have a better solution?
    Thanks
    yve

    thanks

  • Is it possible to sort Mac Mail Rules into alphabetical order?  I have in excess of 50 rules and everytime I want to add to a rule, such as "delete incoming" I have to go through the entire list to find it.

    Is it possible to sort Mac Mail Rules into alphabetical order?  I have in excess of 50 rules and everytime I want to add or amend a rule, such as "delete incoming" I have to go through the entire list to find it.  I have tried clicking on the heading "Description" but it does not sort.  Any assistance would be greatly appreciated

    Hi,
    According to your description, my understanding is that use CMAK to configure split tunneling on VPN clients, traffic to specified devices can be routed via their own default gateway.
    If the manually added route entries all have default metric and interface, clients will select one by the default routing rule, can’t select one of them according to clients’ own conditions. So, I am afraid that CMAK can’t implement the function which you need.
    A blog described about How to configure split tunneling on VPN clients using CMAK, for your reference:
    http://blogs.technet.com/b/rrasblog/archive/2007/06/11/split-tunnelling-using-cmak.aspx
    Best Regards,
    Eve Wang 
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Simple sort question - Numbers '09

    Have a table with a few colums. One is a column of dates and the other of categories.
    Wish to sort the entire table in priority order, first by category, then by date.
    Easy to do in Excel. Am sure Numbers has a way to do this, but can't find it.

    1.
    Verena B.
    44
    Gewicht Verloren
    2.
    Yvonne S.
    41.8
    3.
    Reini K.
    38
    4.
    Martin P.
    35.8
    5.
    Alexandra P.
    35.3
    6.
    Annette E.
    28.5
    7.
    Christine W.
    28
    9.
    Esther H.
    27.5
    8.
    Sascha P.
    26.2
    10.
    Sascha K.
    25.5
    11.
    Rita S.
    23.8
    12.
    Michaela R.
    23.2
    13.
    Alexandra K.
    23
    Top 100
    14.
    Gabriela S.
    22.6
    15.
    Maria C.
    21.1
    16.
    David F.
    21
    17.
    Ellen R.
    20.7
    18.
    Fabienne F.
    20.7
    19.
    Viktor A.
    20.2
    20.
    Rolf W.
    20
    21.
    Ingrid T.
    19.3
    22.
    Diana R.
    19.2
    23.
    Sabine S.
    19.2
    24.
    Elda S.
    18.6
    25.
    Rolf H.
    18.6
    26.
    Chantal V.
    18.5
    27.
    Renè B.
    18.5
    28.
    Ralph W.
    18
    29.
    Barbara B.
    17.7
    30.
    Chris R.
    17.6
    31.
    Inge W.
    17.5
    32.
    Liliane G.
    17.5
    33.
    Reto V.
    17.4
    34.
    Susann M.
    17
    35.
    Ciro A.
    16.7
    36.
    Sabrina B.
    16.6
    37.
    Brent M.
    16.5
    38.
    Jolanda E.
    16.4
    39.
    Alessandro M.
    16.2
    40.
    Ruth M.
    16.2
    41.
    Andrea M.
    16
    42.
    Franz B.
    16
    43.
    Monika S.
    15.9
    44.
    Dominique A.
    15.8
    45.
    Hansjürg G.
    15.7

  • How to create HU and input serial numbers in inbound delivery order?

    User want a good way to create HU and input serial numbers in inbound delivery order, because they need input lots of serial numbers everyday, VL32N is difficult to use for them.
    So I need create a program to finish it, I want to know is there any BAPI function can be use for this propose?

    I used BDC to finish this task.

Maybe you are looking for