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());

Similar Messages

  • 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

  • Can I bulk collect based on a date variable?

    I'm want to use some sort of Bulk collect to speed up this query inside a PL/SQL block (we're in 10g). I have seen examples of using a FORALL statement but I don't know how to accommodate the variable v_cal_date. My idea is to be able to run the script to update a portion of the table "tbl_status_jjs" based on a date range that I provide. tbl_status_jjs contains a list of dates by minute of the day for an entire year and a blank column to be filled in.
    I though of using something like FORALL v_cal_date in '01-apr-2009 00:00:00'..'01-jun-2009 00:00:00' -- somehow need to increment by minute!? ... but that doesn't seem right and i can't find any exmples of a bulk collect based on a date. How do I bulk collect on a date variable? Can I use the date/time from a subset of records from the final table in some sort of cursor?
    Thanks
    Jason
    -- loop through one day by minute of the day and update counts into table  
    v_cal_date Date       :=TO_DATE('01-apr-2005 00:00:00','dd-mm-yyyy hh24:mi:ss');
    intX := 1;
    WHILE intX <= 1440 LOOP
        UPDATE tbl_status_jjs
               SET  (cal_date, my_count) =
                    (SELECT      v_cal_date,
                                 NVL(SUM(CASE WHEN v_cal_date >= E.START_DT AND v_cal_date < E.END_DT THEN 1 END),0) AS my_count
                     FROM        tbl_data_jjs E
               WHERE cal_date = v_cal_date;
        v_cal_date := v_cal_date + (1/1440);
        intX := intX + 1;
        COMMIT;
    END LOOP;

    Here are the two tables. The goal is to find an efficient way to count how many records in tbl_data have a start_dt before and a end_dt after each cal_date in tbl_status.
    01-apr-2005 00:05:00 ==> 3
    01-apr-2005 00:25:00 ==> 1
    DROP TABLE tbl_status;
    CREATE TABLE tbl_status
    (   CAL_DATE    DATE,
        MY_COUNT    NUMBER);
    DECLARE
        start_date Date       :=TO_DATE('01-jan-2006 00:00:00','dd-mm-yyyy hh24:mi:ss');
        end_date   Date       :=TO_DATE('01-jan-2006 01:00:00','dd-mm-yyyy hh24:mi:ss');
    BEGIN
        INSERT INTO tbl_status (CAL_DATE)
        SELECT  start_date + ( (LEVEL - 1) / (24 * 60))
        FROM    dual
        CONNECT BY    LEVEL <= 1 + ( (end_date - start_date) * (24 * 60) );
    END;
    DROP TABLE tbl_data;
    CREATE TABLE tbl_data
    (   START_DT    DATE,
        END_DT      DATE);
    INSERT INTO tbl_data VALUES (TO_DATE('2006-01-01 00:05:00', 'yyyy-mm-dd hh24:mi:ss'), TO_DATE('2006-01-01 00:15:00', 'yyyy-mm-dd hh24:mi:ss'));
    INSERT INTO tbl_data VALUES (TO_DATE('2006-01-01 00:05:00', 'yyyy-mm-dd hh24:mi:ss'), TO_DATE('2006-01-01 00:20:00', 'yyyy-mm-dd hh24:mi:ss'));
    INSERT INTO tbl_data VALUES (TO_DATE('2006-01-01 00:05:00', 'yyyy-mm-dd hh24:mi:ss'), TO_DATE('2006-01-01 00:30:00', 'yyyy-mm-dd hh24:mi:ss'));
    INSERT INTO tbl_data VALUES (TO_DATE('2006-01-01 00:35:00', 'yyyy-mm-dd hh24:mi:ss'), TO_DATE('2006-01-01 00:40:00', 'yyyy-mm-dd hh24:mi:ss'));
    DECLARE
        v_cal_date Date       :=TO_DATE('01-jan-2006 00:00:00','dd-mm-yyyy hh24:mi:ss');
        intX Integer          :=1;
    BEGIN
        WHILE intX <= 60 LOOP
            UPDATE tbl_status
                   SET  (cal_date, my_count) =
                        (SELECT      v_cal_date,
                                     NVL(SUM(CASE WHEN v_cal_date >= E.START_DT AND v_cal_date < E.END_DT THEN 1 END),0) AS my_count
                         FROM        tbl_data E
                   WHERE cal_date = v_cal_date;
            v_cal_date := v_cal_date + (1/1440);
            intX := intX + 1;
            COMMIT;
        END LOOP;
    END;Edited by: Jason_S on Oct 21, 2009 9:00 AM -- i messed up the years/months .. fixed now
    Edited by: Jason_S on Oct 21, 2009 9:13 AM

  • How to build a collection based on the installed definition update version

    Well I would like to know how to crate the collection of those clients are only installed the definition update? for example, KB2461484
    or
    Definition Update for Microsoft Endpoint Protection -KB2461484 (Definition 1.169.2635.0)"

    thaks Sherry. I got the query:
    Query1: via KB title
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner
    join SMS_G_System_PatchStatusEx on SMS_G_System_PatchStatusEx.ResourceId = SMS_R_System.ResourceId where SMS_G_System_PatchStatusEx.Title  =
    "Definition Update for Microsoft Endpoint Protection - KB2461484 (Definition 1.169.2635.0)" and LastStateName =
    "Install Verified"
    Query2: via KB number
    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner
    join SMS_G_System_PatchStatusEx on SMS_G_System_PatchStatusEx.ResourceId = SMS_R_System.ResourceId where SMS_G_System_PatchStatusEx. QNumbers   = =
    "2461484" and LastStateName =
    "Install Verified"

  • How to create a filter based on Effective date EFFDT

    Hello to all,
    I am currently creating reports from an HR database that stores records by employee (EMPLID) based on effective date(EFFDT) and Effective Sequence (EFFSEQ).
    It is easy to get a report that shows all entries up to a certain data (using <= or >=), however, I am not able to create a Filter (in the report or in the prompt)
    that shows me the MAX(EFFDT) up to a certain data dd/mm/yyyy. (any one)
    The sql script we use is the follwiing
    SELECT A.EFFDT, A.EFFSEQ, A.ACTION, A.EMPL_CLASS, *
    FROM PS_JOB A
    WHERE A.EMPLID=' ' ----*(PROMPT1)*
    AND A.EFFDT=(SELECT MAX(B.EFFDT) FROM PS_JOB B
    WHERE B.EMPLID=A.EMPLID
    AND B.EFFDT<=' ') *(PROMPT2)*
    AND A.EFFSEQ=(SELECT MAX(B.EFFSEQ) FROM PS_JOB B
    WHERE B.EMPLID=A.EMPLID
    AND B.EFFDT=A.EFFDT)
    Do I need to create a variable? If yes, How?
    Please send me your suggestions or past experiences with BI on the subject.
    Thanks
    Roberto

    Hi Roberto,
    I would create a session variable via the Oracle BI Administration Tool.
    See the following of how to achieve this:
    http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_Variables4.html
    Reference this variable in your filter. It looks something like this VALUEOF(NQ_SESSION."VARIABLE_NAME")
    Good Luck,
    Daan Bakboord

  • How to update the price based upon PGI date

    Hi
            I have issue of updation of the Prices and freight based on PGI date in the billing we are using the two billing types for the excsies and tax invoice creation .And in the copy control pricing type is maintained Aas "C" for the billing types with single delivery but someHow MRP in the excise billing has been picked from the condition record thats validity is ended and in Tax invoice it picks up the correct prices
    Both pricing condition types has pricing type "B" from Billing date and in the freight we have maintained as "A" SRD
    But for the some cases specially for the excise related part that is based upon the MRP we are facing this issue
    Pricing date is some how coming from sales document
    Please find the problem details in the attachment

    Hi,
    if you see two condition tabs snap shots you can understand clearly because that two invoices has been created in two different dates and you have maintained the pricing date C-billing date ( KOMK-FKDAT).Due to this,the price of ZMRP is coming differently.After you creation of first invoice then you would have changed ZMRP amount.Now while you are creating second invoice ,system has taken new price of ZMRP in billing level.
    Note:While creating second invoice, PGI date might have come into billing level but someone would be changed billing date manually at header level of billing document.Please check that one also.
    Kindly let me know if you need further help on this.
    Thanks,
    Naren

  • How to suppress a row based on current date -  at query level?

    In an Bex query report i have suppress rows based on current date.
    There is no current date available in query.
    there is a date field in the query.
    If by chance the date in that field is lesser than current date, I have to suppress that row.
    How can this be achieved?

    What is the code ofr creating a variable to get values >= to current date?
    I have implemented the following code which is not working.
    data L_S_range like line of E_T_range[].
    CLEAR L_S_RANGE.
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'GE'.
    L_S_RANGE-LOW = SY-DATUM.
    APPEND L_S_RANGE TO E_T_RANGE[].
    Actually i have written in class, which will be inherited in superclass.
    Edited by: akshara20 on Feb 2, 2011 1:21 PM

  • How to List Sales Orders based on Creation Date and Delivery Priority

    Dear all,
    How can we list Sales Orders based on creation date and delivery priority.
    I tried using vl10a transaction code, but there we can see sales order based on delivery date.
    we need to list all sales order based on delivery priority and sales order creation date.
    can any one of you tell me which standard report gives such kind of report. Your suggestions will be highly appreciated.
    Thank you
    Raghu Ram

    Hi Raghu,
    There is no st report available as per your req.
    Using SQVI, you develope one report that is list of sales orders based on your req.
    SQVI is used to convert a Quick View into a query.
    Quick Viewer:
    The Quick Viewer allows you to define reports without having to program yourself. The Quick
    Viewer is especially useful for new users and occasional use.
    Quick Viewer is a tool for generating reports. SAP Query offers the user a whole range of options for defining reports. SAP Query also supports different kinds of reports such as basic lists, statistics, and ranked lists. Quick Viewer, on the other hand, is a tool that allows even relatively inexperienced users to create basic lists.
    Quick View definitions are user-dependent. You can transfer a Quick View into SAP Query in order to make reports, for example, accessible to additional users, or to use the other functions available in SAP Query.
    The following is a comparison of Quick Views and queries:
    Quick Views possess the same functional attributes as queries. However, only basic lists may be defined with Quick Views.
    In contrast to queries, no user group assignment is necessary with Quick Views. Each user has his/her own personal list of Quick Views. Quick Views cannot be exchanged between users. Quick Views may, however, be converted to queries and then be made available to other users in a specific user group.
    Info Sets are not required for Quick View definition. Whenever you define a Quick View, you can specify its data source explicitly. Tables, database views, table joins, logical databases, and even Info Sets, can all serve as data sources for a Quick View. You can only use additional tables and additional fields if you use an Info Set as a data source.
    The Quick Viewer uses various controls. Certain hardware and software requirements must also be fulfilled before you can use the Quick Viewer.
    To define a Quick View, you select certain fields according to your data source that determine the structure of your report. The report can be executed in basis mode with standard layout or may be edited using drag and drop and the other toolbox functions available in WYSIWYG mode.
    Reports created using the Quick Viewer may also be passed to external programs (Excel, for example).
    Call the Quick Viewer using System -> Services -> Quick Viewer (or transaction SQVI).
    Enter the name of the Quick View. Quick View names can contain a maximum of 14 characters.
    Choose Create.
    Enter a title for the Quick View and remarks, if you think they are relevant.
    If you do not want to base your list on a table, use the possible entries pushbutton in the Data source field to select another data source. You can choose logical databases or Info Sets. In addition, you may also create table joins. For further information, see Selecting a Data Source.
    Choose Basis mode if you want to create the list directly with no list design. Choose Layout mode if you want to define the layout of your list yourself.
    SQVI Table Quick viewer – Used to created quick client dependent reports
    Probably the easiest and most flexible way to do this is thru one of the ABAP query transactions.
    Transaction SQVI can do this and it has a very good help function that explains how it works... the drawback is that it is only for one user.
    You can play around with it and see if it meets your needs...
    The query results will come back in an ALV Grid or Excel... you can select what fields are returned, and have a selection screen to enter the search criteria.
    You can get the report by joining the tables VBAK and VBAP.
    If you have any queries, i will forward screen shots to your id.
    Reward points pls.
    Regards,
    Govind.

  • How to store multiple counts based on creation date

    Hi,
    I want to retrieve the count of number of risk  for each date and render it on line graph. I am retrieving data from sharepoint list where the number of risk counts increase with its creation and decreases after it is closure which maintained in another
    column. Like if a risk is created on 02/02/2015 and closes on 03/03/2015 and an another risk is created on 17/02/2015  and closes on 14/03/2015. Then the count of the risk from 02/02/2015 to 16/02/2015 is 1 and from 17/02/2015 to 03/03/2015 is 2  and
    then again till 14/03/2015 is 1. I want to retrieve the count based on the dates rendered dynamically on X-axis that is from current date back to past 24 days. I tried to create two datasets with one storing the risks after being queried based on creation
    date and closure date and retrieving the count from Graph Y values but it is returning me count 0.
    Please help.
    Thanks in advance. 

    Hi,
    I want to retrieve the count of number of risk  for each date and render it on line graph. I am retrieving data from sharepoint list where the number of risk counts increase with its creation and decreases after it is closure which maintained in another
    column. Like if a risk is created on 02/02/2015 and closes on 03/03/2015 and an another risk is created on 17/02/2015  and closes on 14/03/2015. Then the count of the risk from 02/02/2015 to 16/02/2015 is 1 and from 17/02/2015 to 03/03/2015 is 2  and
    then again till 14/03/2015 is 1. I want to retrieve the count based on the dates rendered dynamically on X-axis that is from current date back to past 24 days. I tried to create two datasets with one storing the risks after being queried based on creation
    date and closure date and retrieving the count from Graph Y values but it is returning me count 0.
    Please help.
    Thanks in advance. 

  • How to find the Sum based on Like Dates

    Hello everyone,
    Column 1 contains "Date Sent", Column 2 contains "Dates of Service" and Column 3 contains the payment "Amount" in USD. I want to write a formula that will total up the sum of payment values from column 3 based on the date of payment (Column 1).
    Thanks!
    Jared

    Hi Jared,
    This will do what's illustrated in your example, but has a few restrictions:
    The dates must run in ascending order.
    To get a total for the last date, a later date (with no corresponding amount) must be entered after the last transaction.
    Formula:
    Entered in D2, and filled down the rest of column D:
    =IFERROR(IF(A3>A2,SUMIF($A,A2,C),""),"")
    IFERROR is used to suppress the error message that arises from the formula in D10 referencing a cell in D11.
    Regards,
    Barry

  • How to specify a collection-based TFS group name in process template XML

    I'm trying to modify a work item template so that only members of a certain group can modify it. I have the following:     
    <FIELD name="State" refname="System.State" type="String" reportable="dimension">
    <HELPTEXT>The workflow state of the requirement</HELPTEXT>
    <READONLY not="[project]\Requirements Editors" />
    </FIELD>
    However, I want to be able to add this group globally, or at the very least to a collection instead of a project. The questions I have are:
    I know how to add a new group to a collection (as opposed to a project), but how do I change the XML syntax to see it? I know I can use the prefix [project] to check the current project, but how can I do the same generic thing for a collection instead of
    having to name it here? I have tried [Collection] but that doesn't seem to work.
    Is there some way to make this global? That is, I don't want to have to add this group to each collection, so is there a way to make it accessible by all collections/projects? If so, what is the XML syntax I need, and how do I add the group?
    Even with the basic [project] syntax, and adding the group to a particular project I still can't seem to update the template as I get the following error: "TF212017: Work item tracking schema validation warning: TF26171: User/group '2f0bf5ee-d0f9-4441-b8ad-cbd38b00c407\WHSCC
    Requirements Editors' is not found." What am I doing wrong here?
    Thanks!

    Hi Chris,  
    Thanks for your post.
    For collection group in work item template, we should write like this: [Global]\collectiongroupname.
    The [project] mean current team project, so you need ensure you have created that Requirements Editors group in your current team project, then edit the work item type in current team project.
    And I suggest you install the TFS Power Tools, then edit work item type using VS>>TOOLS>>Process Editor. 
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to make a collection based on successful application deployment?

    Hi,
    Does anyone know how I can make a collection from where the members are all the computers that have successfully installed a particular application.
    I saw this query from another site but i'm having a problem finding the assignmentID for the application I deployed.
    select SMS_R_System.ResourceId from  SMS_R_System inner join SMS_AppDeploymentAssetDetails on SMS_AppDeploymentAssetDetails.MachineID = SMS_R_System.ResourceId where SMS_AppDeploymentAssetDetails.AssignmentID = “16777222″ and SMS_AppDeploymentAssetDetails.StatusType
    = “5″
    Can someone also point me on where I can find the assignmentID for an application?

    Why do you want to do that? Just explain what you are trying to achieve.
    Torsten Meringer | http://www.mssccmfaq.de
    Hi Torsten,
    I wanted to create a collection that will contain the computers which have succeeded an application deployment. So then I can have a list of it. Vice versa, I wanted a list of those that failed. I know that I can do that by replacing the status type to what
    ever corresponds Error or Fail. It just so happen that I can't find the assignmentID.
    Another issue that I'm facing is that my reporting node is not working. I'm currently working on it but I have to get the list of successful/failed application deployment as soon as possible. That's why I though of creating a collection containing only those
    computers.

  • How to sort a sortingTable based on a particular column available in it?

    Hi,
    I am using the sortingTable as follows:
    <Field name='WorkItemTable'>
    <Display class='SortingTable'>
    <Property name='linkEnable' value='true'/>
    <Property name='sortEnable' value='true'/>
    <Property name='columns'>
    <List>
    <String>PROCESS</String>
    <String>DESCRIPTION</String>
    <String>DATE</String>
    </List>
    </Property>
    </Display>
    I need to sort the table's value with respect to 'Date' column available in the sorting table.
    I have used the following property tag under sortingTable.
    <property name='sortEnable' value='true'/>
    But i need to point this sorting functionality to date column..
    Can someone help me to get the solution... Thanks in advance..
    Regards,
    babu

    Hi,
    I am using IdM 7.1 and I observed that default sorting table used by idm for e.g at server task page, doesn't sort on date basis.
    ~Ketan

  • How to sort an xml Based on "property name or node"

    Input
    '<Email>
      <Type>Personal</Type>
      <Code>1</Code>
      <Description>[email protected]</Description>
      <LocalId>000000000000000000000000868000000001</LocalId>  
    </Email>'
    OUPUT
    '<Email>  
      <Code>1</Code>
      <Description>[email protected]</Description>
      <LocalId>000000000000000000000000868000000001</LocalId>  
      <Type>Personal</Type>
    </Email>'
    how do this using sql ? 

    DECLARE @xml as xml
    SET @xml ='<Email>
      <Type>Personal</Type>
      <Code>1</Code>
      <Description>[email protected]</Description>
      <LocalId>000000000000000000000000868000000001</LocalId>  
        <Infeliz>
    <Za>
    Fuck
    </Za>
    <Maria>
    Fuck
    </Maria>
      </Infeliz>
    </Email>'
    SELECT '<Email>' 
    + CONVERT(varchar(1000), @xml.query('for $x in (/Email/*) 
      order by local-name($x) 
                       return $x '))  
           + '</Email>'
    OUPUT - NOT OK 
    <?xml version="1.0" encoding="UTF-8"?>
    <Email>
    <Code>1</Code>
    <Description>[email protected]</Description>
    <Infeliz>
    <Za>Fuck</Za>
    <Maria>Fuck</Maria>
    </Infeliz>
    <LocalId>000000000000000000000000868000000001</LocalId>
    <Type>Personal</Type>
    </Email>
    I want so
    <?xml version="1.0" encoding="UTF-8"?>
    <Email>
    <Code>1</Code>
    <Description>[email protected]</Description>
    <Infeliz>
    <Maria>Fuck</Maria>
    <Za>Fuck</Za>
    </Infeliz>
    <LocalId>000000000000000000000000868000000001</LocalId>
    <Type>Personal</Type>
    </Email>

  • How can I rename files based on their ID3 tags?

    For example I would like to rename the files in a particular folder to have the format <track number> - <track name>.mp3
    I'd rather not used third party software to do this.

    For example I would like to rename the files in a particular folder to have the format <track number> - <track name>.mp3
    I'd rather not used third party software to do this.

Maybe you are looking for

  • KPI ratnig in individual Goals Predefined Performance Management

    Hi We are using predefined Performance Management process and need to add KPI rating for each goal created under individual goal . At present it gives option to give rating for all the new goals at one place in the individual goal . Pl let me know ho

  • SQL Cluster Service Accounts

    Is it advisable to have different service accounts for the all the nodes in a cluster to avoid any potential account authentication issues or do all the nodes in cluster need to use the same account.

  • Receiving an error when opening up a new document

    Error below: I have uninstalled the program and run a registry cleaner to clean out any remnants that failed to uninstall.  Then I ran a new install, doing a complete insstall.   I opened it immediately after intallation, trying to open a new documen

  • Does apple fix or replace ipods that were fixed by someone else?

    My ipod touch was given to a tech person and he returned it back without completely fixing it. I asked him to replace the broken glass with a new one and he returned it back to me breaking it even more. Would apple be able to fix or even replace it w

  • Link doesn't sync

    When I try to sync my N9 or N950 Link reports: "10 photos queued to computer..." but nothing really gets uploaded to the computer. I'm copying the files directly to my NAS. What's the problem?