Sorting Date in Map?

Dear Experts,
I have a table with four fields Project (String), Task (String), StartDate (Date), EndDate(Date)
I need to find Task in each Project having the earliest StartDate and the latest EndDate
Example
LA1C3TINT,B1CYSPOW10,11/15/1999,11/15/1999
LA1C3TINT,B1CYSPOW10,11/15/1999,11/15/1999
LA1C3TINT,B2CYSPOW10,7/15/2000,7/15/2000
LA1C3TINT,B2CYSPOW10,7/15/2000,7/15/2000
LA1C0JGEO,0CGQS2MHL100,3/25/2002,11/23/2004
LA1C0JGEO,0CGQS2063001,3/25/2002,11/23/2004
LA1C0JGEO,0CGQS2063002,3/25/2002,11/23/2004
I was thinking of storing them in map to array, with Project as key
However I don't think I can actually mix type of data in an array, provided I can sort date in array ????
Any pointers will highly be appreciated

Make a class that encapsulates whatever this thing is, either make it Comparable or write a Comparator class, and sort it using either a List or a SortedSet.

Similar Messages

  • UDF for sorting date

    Hi Guys,
    I am doing scenario File to Idoc, i have to sort date in acending order, the date format will be in either 22.10.2007 or 22/10/2007 . can any one send UDF for this.
    Regards,
    venu gopal

    Hi Venu
    You can execute this without UDF. Use " Transform" function in the Date functions.
    When you are using the UDF....you keep the strucure as "yyyMMddhhmmss" for that clickon Trnasform function and there you can see ShowAdvancedProperties...there u can find the format of the source which you are expecting and also change the strucutre of you target expected format.
    You please try this and check the mapping it will get execute.
    Use Standard Date Function DATATRANS. It have the property for format and input is the source date field. It will convert the date format to required specified format which you menstion in the DARTATRANS function
    for UDF
    Re: UDF  for this mapping rule
    Re: Problem in UDF please Help?
    Thanks!

  • Pb retrieving sorted data from Table in SQL.

    Hi,
    I get problem to retrieve data in the right order from table in database SQL.
    See code attached: code.png
    I want to sort data according to ID number And then to retrieve those data and fill out a ring control in the right order "descending" .
    But i got always ID 2 instead of 1. See attached  picture : control.png
    it seems that the select statement (see under) is not woking properly. But it is working well in a query in Access DataBase .  
    //Select statement
       hstmt = DBActivateSQL (hdbc, ("SELECT * FROM %s ORDER BY ID DESCENDING",szTableName));
       if (hstmt<= DB_SUCCESS) {ShowError(); goto Error;}
    Some idea ??
    Lionel.
    Attachments:
    code.PNG ‏39 KB
    control.png ‏32 KB

    Hello Lionel,
    According to the document Robert linked, the prototype of DBActivateSQL() is:
    int statementHandle = DBActivateSQL (int connectionHandle, char SQLStatement[]);
    For the 2nd parameter(SQLStatement), you're sending:
    ("SELECT * FROM %s ORDER BY ID DESCENDING",szTableName)
    Probably your intention is to substitute %s with szTableName, but that's not what it happens.
    By using comma operator, ("SELECT * FROM %s ORDER BY ID DESCENDING",szTableName) is evaluated to szTableName, so you call is equivalent to:
    hstmt = DBActivateSQL (hdbc, szTableName);
    In order to substitute %s with szTableName you need to first build the string you're passing as the 2nd parameter:
    char query[512];
    sprintf(query, "SELECT * FROM %s ORDER BY ID DESCENDING",szTableName);
    hstmt = DBActivateSQL (hdbc, query);

  • How to sort data in cl_gui_alv_tree class?

    Hi,
    I thought that since this object uses an alv grid that the standard sort functionality would exist.  Now that I've developed most of the code, I realize that there is no native sorting functionality.
    Is there some way I can make use of the Superclass CL_ALV_TREE_BASE?
    It has some methods that are "Private", "Instance"  - I'm still a rookie at OO programming in SAP so I'm not sure how best to approach the situation.
    As I see it, I have a few options:
    1)  Manually manage sorting by providing an ascending and descending button/icon on the toolbar and then delete and rebuild the nodes in the tree.
    2)  Manually track the data along with the nodekeys and then use method MOVE_NODE to reposition the data in the tree
    3)  Clone these objects and somehow find the code that is causing the sort options to be suppressed in the toolbar.
    Has anyone built any applications using CL_ALV_TREE_BASE that permit sorting?
    Please don't waste my time by pasting in the links to all the SAP online help for ALV and expect to get points.  Been there, done that.  If there is a particular section that is of specific value, I'll happily study it and report my findings.  Particularly something that explains how to invoke the methods of a superclass and the difference between protected, public, and private.
    Mostly though, I really need a way to sort data in the CL_GUI_ALV_TREE class.
    Thanks

    Hi Ray,
    As far as I know, this will not work. I've had the same problem. The only solution I have found was to re-build the tree each time. It is easier than moving nodes around.
    You can take a look at the class cl_wa_notifications_wps - in case you have a PM or an A&D system.
    Ferenc

  • Use drag and drop to sort data in report

    Hello!
    I found a good description to sort data in a Tabular Form per drag and drop.

    Here is the url: Read Article - Drag &amp;amp; Drop tabular form rows
    It works fine if one follow the hint from Baki (For apex 4.2 one have to adapt a css class).
    Afterwards I tried the same with an Interactive Report. It nearly works.
    I once again had to adapt a css class.
    I used the
    apexir_WORKSHEET_DATA
    class instead of the
    uReportStandard
    in the JavaScript for the Interactive Report.
    Everything went fine. Except the "Save the Thing to the DB" issiu did not work.
    The following code do not work (the "APEX_APPLICATION.G_FROWID.COUNT" is allways 0):
    FOR i IN 1 .. APEX_APPLICATION.G_FROWID.COUNT 
    LOOP
    UPDATE emp SET sort_order = i WHERE rowid = APEX_APPLICATION.G_FROWID(i);
    END LOOP;
    Does anybody know why?
    Best thanks,
    Ilb

  • 'Select a measure:' stuck on 'Loading...' in Dashboard Designer KPI Dimensional Data Source Mapping

    [using SharePoint 2013 Enterprise SP1]
    I am trying to create a KPI in Dashboard Designer, but am getting a timeout. I have been doing this for a while on my site; this is not the first. I haven't had this problem before.
    I created a new KPI and clicked on the Data Mappings column value, which is a hyperlink, to bring up the Dimensional Data Source Mapping dialog. I switched to a Data Connection in the site I just created (DC works perfectly and can retrieve sample data).
    When I click the "Select a measure:" drop-down menu, I get the message "Loading..." and after a while (a minute? two?) a dialog pops up with:
    The request took too long to complete. SharePoint is currently unavailable or experiencing heavy traffic. Try again later.
    This is a test SP server and I'm the only one on it, so there is no load. Also as mentioned, I am able to verify the Data Connection without problem. I am not having any issue with any of my other few dozen KPIs/Data Connections. Any suggestions as to how
    to troubleshoot?

    Hi cgtyoder,
    According to your description, my understanding is that you got an error when you created a KPI in Dashboard Designer.
    Please try to recycle the PerformancePoint Services Application Pool account, compare the result.
    Please go to C:\inetpub\wwwroot\wss\VirtualDirectories\the port of web application, adjust the HttpRuntime executionTimeout for the Web Application by modifying the web.config, now PerformancePoint report stability is much better:
    <httpRuntime executionTimeout="600" maxRequestLength="51200" />
    Note: before you change the web.config file, please make a bakcup for the file.
    If this issue still exists, please go to the log file to find more information about this issue.
    I hope this helps.
    Thanks,
    Wendy
    Forum Support
    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 Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

  • How do I sort data in columns using Pages

    How do I sort data in columns (alphabetically) using Pages?

    If you are referring to text or numbers in a column (not table), then get the free Service plug-in WordService, from Devon Technologies. Put it in the
    /Users/yourlogin/Library/Services folder location.
    Select your data to be sorted. From the Pages menu > Services > Sort Ascending will do the trick. This will work with Pages ’09 and Pages v5.2 or later, as well as Apple Mail, TextEdit, etc.
    The WordService files include a PDF (Read Me) that describes the services included with the package.
    The Service items will only appear in the Services submenu when you have selected your data prior to sort. If these WordService items do not appear in the Services menu as they should per the preceding sentence, then you will need to enable them.
    System Preferences > Keyboard > Shortcuts > Services. Scroll through the right hand list of services until you encounter Sort Ascending and ensure that it is selected.
    If you were referring to sorting a column of data in a table:
    Pages ’09
    Select all cells containing your unordered data. In the Table Inspector, under Edit Rows & Columns, choose Sort Ascending.
    Pages v5.2
    Select cells as before. In the Table heading (A, B, C, etc.) when you roll over the letter, a down-arrow appears. Click, and choose Sort Ascending from the drop down menu.

  • SPGridView - sorting Dates doesn't work properly & how to display the title column as link?

    Hi,
    I've got a SPGridView that is being filled with data from several lists. Some of them are a date-field and a title-field. I already added sorting, paging and filtering options and at first look they seem to work fine. But now I noticed that sorting dates
    doesn't work as expected. If I select ascending sorting, the result is something like this:
    01.08.2014
    02.08.2014
    17.07.2014
    18.07.2014
    23.07.2014
    If I select descending sorting, the result is this:
    23.07.2014
    18.07.2014
    17.07.2014
    02.08.2014
    01.08.2014
    This isn't what I want obviously. 
    I just added the EventReceiver for the sorting like it is shown in several tutorials:
    (The date field is a BoundField.)
    grid.Sorting += new GridViewSortEventHandler(grid_Sorting);
    private void grid_Sorting(object sender, GridViewSortEventArgs e)
    if (ViewState["FilterExpression"] != null)
    gridDS.FilterExpression = (string)ViewState["FilterExpression"];
    And my second problem is how to add a link to the title column. In my grid I'm displaying tasks from different lists and I want to link the title to the related task. I stumbled accross HyperLinkFields and tried this:
    HyperLinkField hyperLinkField = new HyperLinkField();
    hyperLinkField.DataTextField = "Titel";
    hyperLinkField.DataNavigateUrlFields = new string[] { "Titel" };
    hyperLinkField.DataNavigateUrlFormatString = "{0}";
    hyperLinkField.HeaderText = "Titel";
    hyperLinkField.SortExpression = "Titel";
    grid.Columns.Add(hyperLinkField);
    The resulting link is something like ...sites/MySite/_catalogs/masterpage/A1-V1-2 where "A1-V1-2" is the name of the task and also shown in the title field.
    The actual link should look more like ...sites/MySite/Lists/mytasklistname/DispForm.aspx?ID=.... or something like that to display the task details. How could I achieve that?
    Thanks in advance

    http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/MS-SharePoint/Q_27718782.html
    Here is the exact code you need to use:
    http://social.msdn.microsoft.com/Forums/ar/sharepointcustomization/thread/c463a8c6-4806-4233-b6a4-8db8369c5fc2
    http://sharepoint.stackexchange.com/questions/53459/change-title-linked-to-item-with-edit-menu-to-different-column
    Open the AllItems.aspx page for the specific list.
    Search for the <ViewFields> tag
    List item LinkToItem="TRUE" to whichever column you want the link:
    <ViewFields><br/>
    <FieldRef Name="Attachments"/><br/>
    <FieldRef Name="LinkTitle"/><br/>
    <FieldRef Name="linkThisColumn" LinkToItem="TRUE"/><br/>
    <FieldRef Name="data_x0020_column"/><br/>
    <FieldRef Name="Another_x0020_column"/><br/>
    </ViewFields><br/>
    http://sharepoint.stackexchange.com/questions/58954/link-title-in-list-to-value-in-url-column
    Create calculated column.
    Insert following formula -
    ="<a href='"&UrlFieldName&"'>"&Title&"</a>"
    Set "data type returned from this formula is" to integer.
    As a result on list view you will see the title with link to your url.
    UPD: It seems that URL field is not valid for calculated column, as workaround you can copy url value in a receiver into the another text field, which is not shown on the view.
    If this helped you resolve your issue, please mark it Answered

  • Sort data does not match song info

    I've just discovered that some of my songs have sort data from different files. Short of going though all my music song by song is there a way to clear all sort data?

    Generally setting a common Album Artist will fix split albums.
    For deeper problems see Grouping tracks into albums.
    tt2

  • Performance - using JDBC call with 'order by' vs sorting data on app server

    Hello! I need some valid thoughts on the performance of using a JDBC call versus processing information on the application server.
    Here is the somewhat simplified scenario:
    I need to retrieve customer information (name, e-mail, telephone), display it in HTML format and then be able to redisplay it in a different order. For example, initially the list would be displayed sorted by last name, but then a user might choose to sort it by e-mail address. Initial call to DB uses 'order by' in the SQL stmt to get me the initial ordering by last name. Results are stored in 2D array. However, when a user selects a different sort I have two options:
    1) just make another call to the DB with a different order by clause. This means I need to create a DB connection, connect to DB, retrieve the results and read them from result set into a 2 dimensional array
    2) re-sort data in the 2D array populated during the initial call. This means I need to use java.util.Arrays.sort(my_2D_resultsArray, my_custom_comparator)
    Question is : which is more efficient? Number of entries retrieved can be anywhere from 0 to a few thousands (depending on other filters such as customer's country). My feeling is that option umber 2 is better, but I would like to get your opinion.
    Thank you!

    Good points! Thanks! I ran a test (see code below) and it takes less than a second to sort 2000 Strings and 2000 nulls. The only thing I ran the test at a UNIX prompt as oppose to from within app server (Weblogic). I expect the speed to be compatible though. Do you think that test was valid and tells us that sorting on the app server is probably faster than doing another SQL query?
    import java.io.*;
    import java.math.*;
    import java.util.*;
    import java.util.Arrays.*;
    public class Test {
      public static void main(String[] args) throws Exception {
        Test test = new Test();
        test.testSortingPerformance();
      public void testSortingPerformance() {
        Object[] objArray2 = new Object[]{};
        Vector v = new Vector();
        Date start, end;
        java.util.Random rd = new java.util.Random(2000);
        for (int i = 0; i < 2000; i++){
          v.add(new Object[]{new String("" + rd.nextInt())});
          v.add(new Object[]{null});
        objArray2 = v.toArray();
        Object[] innerObjArray2 = new Object[]{};
        MyComparator2 myComp = new MyComparator2();
        start = new Date();
        java.util.Arrays.sort(objArray2, myComp);
        end = new Date();
        for (int i = 0; i < objArray2.length; i++) {
          System.out.println();
          innerObjArray2 = (Object[])objArray2;
    for (int j = 0; j < innerObjArray2.length; j++) {
    System.out.print(innerObjArray2[j] + " ");
    System.out.println(v.size());
    System.out.println("Start " + start + " End " + end);
    import java.util.*;
    public class MyComparator2
    implements Comparator {
    //position in the inner array to use for comparison
    private int position = 0;
    //default empty constructor
    public MyComparator2() {
    //implement compare method
    public int compare(Object o1, Object o2) {
    Object[] strAr1 = (Object[]) o1;
    Object[] strAr2 = (Object[]) o2;
    if (strAr1[0] == null){
    if (strAr2[0] == null){
    return 0;
    else{
    return -1;
    else if (strAr2[0] == null){
    return 1;
    return ( (String) strAr1[0]).compareTo( (String) strAr2[0]);

  • Iphone 5 Excessive Data Usage Mapping Services

    I have had my Iphone 5 since December 2013. Recently I have been having problems with my cellular data usage where my phone will use more than 900mb a day. After investigating the issue I noticed that the biggest problem is mapping services. This was not making sense as frequent location settings and all location settings are switched off. I went to my service provider MTC (This is the service provider in Namibia, Africa) and they advised me to upgrade to IOS 7.1.2. According to them Apple has made more services available on our carrier and that I needed the newest IOS to be able to manage these services.
    I have updated my IOS to 7.1.2 yesterday 28 July at 12:00. Since then till yesterday afternoon at 17:00 my phone used over 500mb of which 418mb was for system services which after investigation revealed that 415mb was for mapping services. The location settings and frequent location settings are still switch off, but I am still using data for mapping services. The data in Namibia is not the cheapest and this has caused me to have to switch off my cellular data to ensure that I don't run my cellphone bill through the roof. I am now sitting with an equivalent of a Nokia 3310 as I can only sms and phone from my Iphone. I do not have access to WIFI so using that is not an option.
    I have a friend with a Iphone 5S and one with and Iphone 4 and they do not seem to have the same problem as I do. Is it only Iphone 5?
    If anyone has the same problem, I hear that it is also the case in South Africa, please help me make it heard by Apple or give me a solution if you have one.

    I see about 500MB for "Time & Location" tracking. You can check here: Mobile Network -> System tasks -> Time & Location (roughly translated from German iOS 7 menu. Can someone please write down the correct english menu entries?).
    I believe it is the Google App (https://itunes.apple.com/de/app/id284815942?mt=8), which is tracking me (https://maps.google.com/locationhistory/b/0). I like beeing tracked since i'm sometimes curious where i have spent my time;). But 500MB is far too much - i have only 1GB per month.

  • Sort data in a ref cursor

    Hello,
    I would like to know if the following is possible:
    I'm getting data from different sources in a ref cursor. Is it possible to sort this ref cursor on a specific column in the ref cursor? If so, how?
    Thanks
    Karuna

    Note that this is a duplicate post of this thread
    sort data in ref cursor
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Sort Date format in Oracle XML Publisher

    Hi All,
    I have a requirement like trx_date sort. i have taken trx_date in dd-mon-yyyy format. now i given sort option like this..
    <?for-each:G_TRX_ORDER_NUMBER?><?sort:TRANSACTION_TYPE?><?sort:DUE_DATE;'ascending';data-type=date?> <?sort:TRX_NUMBER?>
    now i have 3 dates
    07-NOV-10
    20-MAY-11
    20-DEC-10
    using above sort option.. this dates are not coming as per the ascending order.
    Can any one tell me what i have to ?
    Thanks

    What is your application release?
    Does the sort work for other data types?
    What if you change "<?sort:DUE_DATE;'ascending';data-type=date?>" to "<?sort:DUE_DATE;'ascending';data-type='date'?>", does it make any difference?
    Few examples about the sort can be found in these docs/links.
    How to Group Data Dynamically at Runtime in a BI/XML Publisher RTF Template? [ID 1062816.1]
    Sorting Data In eText Template [ID 1263511.1]
    Oracle XML Publisher User's Guide
    http://download.oracle.com/docs/cd/B25516_18/current/acrobat/115xdoug.zip
    Thanks,
    Hussein

  • Sorting Data in Tables

    Hi anyone help with trying to resolve an issue with sorting data in a table I have created in Pages 08 v 3.0.2.
    I have a table six columns across with rows down of data. I have so far entered 10 rows of data and wanted to sort the data based on column 1 then column 2 with the associated data in the other columns staying connected to column 2. Fairly straightforward stuff I thought so clicked the table header for column 1 then the ascending sort button in Inspector the results I got were not quite what I expected.
    Here are three lines of data taken from columns 1 & 2. The sequence below is how I entered it. The data as you will see relates to classical music. In column 1 is the single word 'Mozart' all the other data is in column 2 on one line:
    Mozart Symphony No 29 in A Major KV201
    Mozart Symphony No 4 in D Major KV19
    Mozart Symphony No 36 in C Major KV425 'Linz'
    When I clicked the header for column 1 then the button in Inspector to sort the data ascending this is the result I got:
    Mozart Symphony No 29 in A Major KV201
    Mozart Symphony No 36 in C Major KV425 'Linz'
    Mozart Symphony No 4 in D Major KV19
    The first two entries are in the right order but the third one should obviously be first. Anyone know how I could resolve the issue I have with sorting data in the table I have created?
    Thanks ....

    Just to expand on Beatrice's answer, Pages (as most other word processors) sorts alphabetically. 4 comes after 39 alphabetically because the 4 comes after the 3. It doesn't think, "oh, that's the number 4 which is smaller than the number 39." By placing the leading 0 we wind up comparing 04 to 39 and yes, the zero is in front of the 3 so it gets placed ahead of it.

  • Excel14.4.7 (Excel for Mac 2011); can't sort data

    Upgraded to Excel for Mac 2011 (v.14.4.7) and cannot sort data. Have read instructions but keep getting error message "missing column/row name"
    Tried doing it with box checked "My list has headers" and with the box unchecked....same non-result and error message.
    I'm doing something wrong, obviously but can't figure it out. I am totally mystified & frustrated!
    any ideas????
    Thank you
    Rose

    This may be a related issue and fix:
    https://discussions.apple.com/message/26086328#26086328

Maybe you are looking for

  • How do I set the newest version of Firefox to remember passwords for websites ?

    Well, ... let me restate that. I think my current version DID remember passwords for me but now it doesn't . I access the options and go to privacy and security but it doesn't highlight to allow me to click on " remember passwords....................

  • Moving Music From PC Hard Drive to External Hard Drive?

    Okay, I'm pretty new to iTunes, so sorry if this is a dumb question. I have a bunch of music on my PC's hard drive. It's of course also on iTunes. I want to move my music from my computer's hard drive to an external USB hard drive, so I don't clog up

  • How do i connect an epson 7900 printer to an apple extreme

    I just purchased an Epson 7900 HDR printer that is in my den. I have it connected with a USB connection on the Airport Extreme to the network connection on the back of the printer.I am trying to print wirelessly from my Imac that is located in anothe

  • Match code in 3.1h

    I am working in 3.1h . I have to add a search help for one of the fields in the ztable i created. I am using that field in the select-options.I appreciate your response

  • Error playing Mp3 sound in flashcs4, actionscript 2.0

    Hi, I'm trying to play an MP3 song in flashlite. I'm using Flash CS4, action script 2.x, flaslite 2.x versions with NOKIA 6300 as simulatore device. I followed When i run it in simulatore it is giving me the following error: FTPS032: A Call to GetURL