Compare mm/yyyy

Post Author: dura13
CA Forum: Formula
HI
I'm having trouble figuring out the formula to compare the month/year of 1 field versus the month/year of another.
Here's what I have sofar.
dateadd("m",-6,currentdate)   this will take me back 6 months to todays date, but i want the month/year and not the month/day/year. The second variable will be an invoice date that I want to also be in the format month/year and this is where i need the year to come into play.
Any suggestions on how i can either drop the day parameter from both dates or is i just easier to do something along this line.
(dateadd("m",-6,currentdate) - (day(currentdate) - 1))
just thought of this formula as i was writing the question **
Thanks in advance
I realized this won't work as it only gets me to the first day of the month. I really need to format these date fields in the formula to be month/year.

Post Author: dura13
CA Forum: Formula
IF TOTEXT(DATEADD("M",-{?MONTHS},CURRENTDATE),"MM/yyyy")<   totext({so_bol_headers.bolh_invoice_date},"MM/yyyy")
back to the drawing board. almost have all the humps worked out, but now this one is causing me problems. going to try 2 compares. 1 for the month and 1 for the year.

Similar Messages

  • "Other Devices" Yellow Question Marks

    In my quest to get sound on my computer, I have noticed that everything under my "Other Devices" tab under "Device Manager" has the yellow question marks beside them. I have a "Biometric Coprocessor" "Network Controller" "SM Bus Controller" and a "Unknown Device" tab listed here. Should I be concerned about these? And, if so, is this another driver issue like the sound was? Thanks for your time and here are my specifics.
     MS Windows XP Professional 32-bit SP3
    CPU
     Intel Core Duo T2700  @ 2.33GHz 54 °C
     Yonah 65nm Technology
    RAM
     2.00 GB Dual-Channel DDR2 @ 332MHz (5-5-5-15)
    Motherboard
     LENOVO 20088DU (None) 57 °C
    Graphics
     Plug and Play Monitor (1400x1050@60Hz)
     512MB ATI MOBILITY FireGL V5200 (Lenovo)
    Hard Drives
     98GB Hitachi HTS721010G9SA00 (SATA) 33 °C
    Optical Drives
     HL-DT-ST DVDRAM GSA-4083N
    Audio
     SoundMAX Integrated Digital HD Audio
    Solved!
    Go to Solution.

    This table might help you.
    You also can try to identify the device in the device manager on the "Details" - tab of each device in the "Device instance ID".
    If there is an ID like "PCI\VEN_yyyy&DEV_xxxx..." input the "xxxx" in the right imput field on www.pcidatabase.com
    In the result list compare the "yyyy" (above) with the VEN-ID and then you have found the device name.
    Other/similar  "Device instance ID" starting with "USB..." or "ACPI" you will find in the table i've linked above.
    The drivers you will find here
    Have success.
    My home-forum: http://www.thinkpad-forum.de
    Wiki: Deutsches ThinkPad-Wiki English ThinkWiki
    My ThinkPad-Collection

  • How to Convert MM/DD/YYYY to YYYY/MM/DD in SQL Reporting Services

    i am having difficulty of converting a parameter field, called @startdate, on sql reporting services report to YYYY/MM/DD format.  the parameter @Startdate was set to Data/Time.  @Startdate is 6/1/2014 12:00:00 and I want to convert it
    to 2014/06/01.  I want to compare @Startdate with a column in database called Begindate which is in format of YYYY/MM/DD hh:mm:ss.  I tried the followings
    select * from Atable where cast(Atable.Begindate as date) >= cast(@Startdate as date)
    select * from Atable where cast(Atable.Begindate as date >= cast(convert(datetime, @Startdate) as date)
    SQL Reporting Services only gives me Text, Boolean, Date/Time, Integer and Float.
    Regards,

    Hi Elmucho,
    Sorry for the delay. I tested with the sample data you provided, however everything works well in-house. Could you please creste a new report and check the result. Here are the steps I performed:
    1.  Create a table and insert the following data:
    Name (varchar(50))    Begindate (datetime, not null)    
    Lastdate (datetime, not null)
    bob                          
    2008-01-01 08:08:08.000      2010-10-10  
    10:10:10.000
    alice                         
    2010-10-10 10:10:10.00       2011-11-11
      11:11:11.000
    smith                       
    2011-11-11 11:11:11.00       2012-12-12   
    12:12:12.000    
    2. Open SQL Server Data Tools, create the data source and add the dataset with the below query:
    SELECT     Name, Begindate, Lastdate
    FROM         [tablename ]
    WHERE     (CAST(Begindate AS date) >= CAST(@Startdate AS date)) AND (CAST(Lastdate AS date) <= CAST(@Enddate AS date))
    3. Then, click execute button, it prompts for inputting the parameter value.
    @Startdate        
    6/1/2008
    @Enddate          
    5/1/2014
    Enter the date and press OK.
    4. Here is the result in the query designer:
    Insert a table and fields. Save the report and preview:
    Thanks.
    Tracy Cai
    TechNet Community Support

  • Data in the cube is showing multiple entries when compared with ODS

    Hello BW Gurus,
    We have a waste report in production planning on Cube and ODS separately. The same info package loads both targets (which means same infosource) but when we run a report on Cube, the records are showing multiple entries (i.e. Key Figures are not matching when compared to ODS) where as the ODS records are showing correctly as it was in R/3. There are totally 6 key figures out of which 4 pulled from R/3 and 2 are populated in BW.
    An Example:
    Waste report in PP run for plant 1000 for 12/2005 and process order 123456. The operational scrap should be 2.46% and the component scrap should be 3.00% for material 10000000. The report is showing 7.87% for planned operational waste % and 9.6% for planned component waste %. These values are not correct. The ODS values for order 123456 matched the data in R/3 for component and operational scrap.
    There is a Start routine to the ODS and also to the cube. I am not good at ABAP so requesting your Help.
    Here is the ODS Code:
    tables: /BI0/PPRODORDER.
    loop at data_package.
    select single COORD_TYPE
    PRODVERS
    into (/BI0/PPRODORDER-COORD_TYPE,
    /BI0/PPRODORDER-PRODVERS)
    from /BI0/PPRODORDER
    where PRODORDER = data_package-PRODORDER
    and OBJVERS = 'A'.
    if sy-subrc = 0.
    if /BI0/PPRODORDER-COORD_TYPE = 'XXXX'
    or /BI0/PPRODORDER-COORD_TYPE = 'YYYY'.
    data_package-PRODVERS = space.
    else.
    data_package-PRODVERS = /BI0/PPRODORDER-PRODVERS.
    endif.
    endif.
    if data_package-calday = space
    or data_package-calday = '00000000'.
    if data_package-TGTCONSQTY NE 0.
    data_package-calday = data_package-ACTRELDATE.
    endif.
    endif.
    modify data_package.
    endloop.
    Here is Cube Code:
    tables: /BI0/PPRODORDER,
    /BIC/ODS.
    TYPES:
    BEGIN OF ys_mat_unit,
    material TYPE /bi0/oimaterial,
    mat_unit TYPE /bi0/oimat_unit,
    numerator TYPE /bi0/oinumerator,
    denomintr TYPE /bi0/oidenomintr,
    END OF ys_mat_unit.
    DATA:
    l_s_mat_unit TYPE ys_mat_unit,
    e_factor type p decimals 5.
    loop at data_package.
    select single COORD_TYPE
    PRODVERS
    into (/BI0/PPRODORDER-COORD_TYPE,
    /BI0/PPRODORDER-PRODVERS)
    from /BI0/PPRODORDER
    where PRODORDER = data_package-PRODORDER
    and OBJVERS = 'A'.
    if sy-subrc = 0.
    if /BI0/PPRODORDER-COORD_TYPE = 'XXX'
    or /BI0/PPRODORDER-COORD_TYPE = 'YYY'.
    data_package-PRODVERS = space.
    else.
    data_package-PRODVERS = /BI0/PPRODORDER-PRODVERS.
    endif.
    endif.
    if data_package-calday = space
    or data_package-calday = '00000000'.
    if data_package-TGTCONSQTY NE 0.
    data_package-calday = data_package-ACTRELDATE.
    endif.
    endif.
    data_package-agsu = 'GSU'.
    data_package-agsu_qty = 0.
    select single gr_qty
    base_uom
    into (/BIC/ODS-gr_qty,
    /BIC/ODS-base_uom)
    from /BIC/ODS
    where prodorder = data_package-prodorder
    and material = data_package-material.
    if sy-subrc = 0.
    if /BIC/ODS-base_uom = 'GSU'.
    data_package-agsu_qty = /BIC/ODS-gr_qty.
    else.
    SELECT SINGLE * FROM /bi0/pmat_unit
    INTO CORRESPONDING FIELDS OF l_s_mat_unit
    WHERE material = data_package-material
    AND mat_unit = 'GSU'
    AND objvers = 'A'.
    IF sy-subrc = 0.
    IF l_s_mat_unit-denomintr <> 0.
    e_factor = l_s_mat_unit-denomintr /
    l_s_mat_unit-numerator.
    multiply /BIC/ODS-gr_qty by e_factor.
    data_package-agsu_qty = /BIC/ODS-gr_qty.
    ENDIF.
    else.
    CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
    EXPORTING
    INPUT = /BIC/ODS-gr_qty
    NO_TYPE_CHECK = 'X'
    ROUND_SIGN = ' '
    UNIT_IN = /BIC/ODS-base_uom
    UNIT_OUT = 'GSU'
    IMPORTING
    OUTPUT = DATA_PACKAGE-gsu_qty
    EXCEPTIONS
    CONVERSION_NOT_FOUND = 1
    DIVISION_BY_ZERO = 2
    INPUT_INVALID = 3
    OUTPUT_INVALID = 4
    OVERFLOW = 5
    TYPE_INVALID = 6
    UNITS_MISSING = 7
    UNIT_IN_NOT_FOUND = 8
    UNIT_OUT_NOT_FOUND = 9
    OTHERS = 10.
    endif.
    endif.
    endif.
    modify data_package.
    endloop.
    some how the AGSU qyt is not populating in the cube and when I dbug the code, I could see a clean record in the internal table but not in the cube.
    your suggestion and solutions would be highly appreciated.
    thanks,
    Swathi.

    Hi Swathi
    In ODs we have option of overwriting and addition however in Cube we have only adition.Thats why you are getting multiple enteries.
    If you are running daily full load on the cube then please delete the earlier requests.
    So at one point of time there should be only one full load request in cube. Hope this will solve your problem.
    Regards,
    Monika

  • Data in the cube is showing wrong when compared with ODS

    Hello BW Gurus,
    We have a waste report in production planning on Cube and ODS separately. The same info package loads both targets (which means same infosource) but when we run a report on Cube, the records are showing multiple entries (i.e. Key Figures are not matching when compared to ODS) where as the ODS records are showing correctly as it was in R/3. There are totally 6 key figures out of which 4 pulled from R/3 and 2 are populated in BW. 
    An Example:
    Waste report in PP run for plant 1000 for 12/2005 and process order 123456.  The operational scrap should be 2.46% and the component scrap should be 3.00% for material 10000000.  The report is showing 7.87% for planned operational waste % and 9.6% for planned component waste %.  These values are not correct.  The ODS values for order 123456 matched the data in R/3 for component and operational scrap.
    There is a Start routine to the ODS and also to the cube. I am not good at ABAP so requesting your Help.
    <b>Here is the ODS Code:</b>
    tables:  /BI0/PPRODORDER.
      loop at data_package.
        select single COORD_TYPE
                      PRODVERS
          into (/BI0/PPRODORDER-COORD_TYPE,
                /BI0/PPRODORDER-PRODVERS)
          from /BI0/PPRODORDER
         where PRODORDER = data_package-PRODORDER
           and OBJVERS   = 'A'.
        if sy-subrc = 0.
          if /BI0/PPRODORDER-COORD_TYPE = 'XXXX'
          or /BI0/PPRODORDER-COORD_TYPE = 'YYYY'.
            data_package-PRODVERS = space.
          else.
            data_package-PRODVERS = /BI0/PPRODORDER-PRODVERS.
          endif.
        endif.
        if data_package-calday = space
        or data_package-calday = '00000000'.
          if data_package-TGTCONSQTY NE 0.
            data_package-calday = data_package-ACTRELDATE.
          endif.
        endif.
        modify data_package.
      endloop.
    <b>Here is Cube Code:</b>
    tables:  /BI0/PPRODORDER,
               /BIC/ODS.
      TYPES:
      BEGIN OF ys_mat_unit,
        material                 TYPE /bi0/oimaterial,
        mat_unit                 TYPE /bi0/oimat_unit,
        numerator                TYPE /bi0/oinumerator,
        denomintr                TYPE /bi0/oidenomintr,
      END OF ys_mat_unit.
      DATA:
        l_s_mat_unit             TYPE ys_mat_unit,
        e_factor                 type p decimals 5.
      loop at data_package.
        select single COORD_TYPE
                      PRODVERS
          into (/BI0/PPRODORDER-COORD_TYPE,
                /BI0/PPRODORDER-PRODVERS)
          from /BI0/PPRODORDER
         where PRODORDER = data_package-PRODORDER
           and OBJVERS   = 'A'.
        if sy-subrc = 0.
          if /BI0/PPRODORDER-COORD_TYPE = 'XXX'
          or /BI0/PPRODORDER-COORD_TYPE = 'YYY'.
            data_package-PRODVERS = space.
          else.
            data_package-PRODVERS = /BI0/PPRODORDER-PRODVERS.
          endif.
        endif.
        if data_package-calday = space
        or data_package-calday = '00000000'.
          if data_package-TGTCONSQTY NE 0.
            data_package-calday = data_package-ACTRELDATE.
          endif.
        endif.
        data_package-agsu     = 'GSU'.
        data_package-agsu_qty = 0.
        select single gr_qty
                      base_uom
          into (/BIC/ODS-gr_qty,
                /BIC/ODS-base_uom)
          from /BIC/ODS
         where prodorder = data_package-prodorder
           and material  = data_package-material.
        if sy-subrc = 0.
          if /BIC/ODS-base_uom = 'GSU'.
            data_package-agsu_qty = /BIC/ODS-gr_qty.
          else.
            SELECT SINGLE * FROM /bi0/pmat_unit
              INTO CORRESPONDING FIELDS OF l_s_mat_unit
              WHERE material   = data_package-material
                AND mat_unit   = 'GSU'
                AND objvers    = 'A'.
            IF sy-subrc = 0.
              IF l_s_mat_unit-denomintr <> 0.
                e_factor = l_s_mat_unit-denomintr /  
                              l_s_mat_unit-numerator.
                multiply /BIC/ODS-gr_qty by e_factor.
                data_package-agsu_qty = /BIC/ODS-gr_qty.
              ENDIF.
            else.
              CALL FUNCTION 'UNIT_CONVERSION_SIMPLE'
                EXPORTING
                  INPUT                = /BIC/ODS-gr_qty
                  NO_TYPE_CHECK        = 'X'
                  ROUND_SIGN           = ' '
                  UNIT_IN              = /BIC/ODS-base_uom
                  UNIT_OUT             = 'GSU'
                IMPORTING
                  OUTPUT               = DATA_PACKAGE-gsu_qty
                EXCEPTIONS
                  CONVERSION_NOT_FOUND = 1
                  DIVISION_BY_ZERO     = 2
                  INPUT_INVALID        = 3
                  OUTPUT_INVALID       = 4
                  OVERFLOW             = 5
                  TYPE_INVALID         = 6
                  UNITS_MISSING        = 7
                  UNIT_IN_NOT_FOUND    = 8
                  UNIT_OUT_NOT_FOUND   = 9
                  OTHERS               = 10.
            endif.
          endif.
        endif.
        modify data_package.
      endloop.
    some how the AGSU qyt is not populating in the cube and when I dbug the code, I could see a clean record in the internal table but not in the cube.
    your suggestion and solutions would be highly appreciated.
    thanks,
    Swathi.

    Hi Swathi,
    May be you might want to look into the way the % is being calculated in the cube. If the formula involves counting the no. of records, then you will also be counting the -ve records that are posted in the cube unless you have had a compression on the cube. that might give you wrong numbers.
    Doniv

  • Need help in using SQL in a jsp file to compare date and time

    hi every one,
    Actually I am doing a project using JSP. I need to compare a date field in the database (MS Acess) to the current system date and time. I have to do this in a select statement.
    I have alredy defined a variable of type Date in the JSP file and I am comparing this variable to the date in the database through a select statemant.
    Here is what I am doing
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
              java.util.Date today = new java.util.Date();
              String myDate=sdf.format(today);
    query = "SELECT Car_ID, Model_ID, Year, Ext_Color, Price from Cars where EDate <= "+myDate+" ;";
    EDate is the feild in the database and it's format is (5/12/2008 5:29:47 PM) it is of type Date/Time in MS Acess.
    when I execute the query it gives the following error
    SQL error:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'EDate <= 2008-10-16 08:10:07'.
    I hope any one can help me with that error and answer my question, I've tried too many things but nothing helps
    Thanks in advance :-)

    Hi,
    When the comparision is needed to be done with the current date , we don't need to send in Java
    Date then format it and compare with MS Acess Date.
    In MS Access we have Date() function which will give you the current date.
    So you can try rewriting your query as following :
    query = "SELECT Car_ID, Model_ID, Year, Ext_Color, Price from Cars where EDate <= Date() ;"; ---------------------
    Hope this helps.
    Thanks

  • Compare dates....

    Hi,
    I have a question. I have to get information out of a Novell
    database using LDAP. One thing is the "LastRegisteredTime" all that
    is possibble and it give the dat like this:
    20060507072033Z To us e this date I had to rearrange it a
    little bit...
    So it ends up like this:
    2006-05-07.
    What I really want to do is to compare this date with the
    current date... And if the date has another (earlyer) year or a
    month value of two months earlier then the current month (in the
    same year)... Then I would like to show the data for these
    records...
    Currently I made something like this:
    However it still doesn't do what I want:
    <cfset jaar1 = DateFormat(Now(), "YYYY-MM-DD")>
    <cfldap action="QUERY"
    name="qtest"
    attributes="cn, wMNAMEUser, zENINVSerialNumber,
    ZENINVlastscandate, wMLastRegisteredTime, lastLoginTime"
    start=""
    scope="SUBTREE"
    filter="objectClass=Workstation"
    server=""
    >
    <!--- last registered date bewerken--->
    <cfset jaar= left(qtest.wMLastRegisteredTime, 4)>
    <cfset maand= Mid(qtest.wMLastRegisteredTime,5,2)>
    <cfset dag= Mid(qtest.wMLastRegisteredTime,7,2)>
    <cfset datum = #DateFormat(CreateDate(jaar, maand, dag),
    "yyyy-mm-dd")#>
    <cfloop query="qtest">
    <cfset jaar= left(qtest.wMLastRegisteredTime, 4)>
    <cfset maand= Mid(qtest.wMLastRegisteredTime,5,2)>
    <cfset dag= Mid(qtest.wMLastRegisteredTime,7,2)>
    <cfset datum = #DateFormat(CreateDate(jaar, maand, dag),
    "yyyy-mm-dd")#>
    <cfset comparison = DateCompare(datum, jaar1)>
    <cfswitch expression = #comparison#>
    <cfcase value = "-1">
    <h3><cfoutput>#DateFormat(datum)#
    </cfoutput> (Date 1) is
    earlier than <cfoutput>#DateFormat(jaar1)#
    </cfoutput> (Date 2)</h3>
    <I>The dates are not equal</I>
    </cfcase>
    <cfcase value = "0">
    <h3><cfoutput>#DateFormat(datum)#
    </cfoutput> (Date 1) is equal
    to <cfoutput>#DateFormat(jaar1)#
    </cfoutput> (Date 2)</h3>
    <I>The dates are equal!</I>
    </cfcase>
    <cfcase value = "1">
    <h3><cfoutput>#DateFormat(datum)#
    </cfoutput> (Date 1) is later
    than <cfoutput>#DateFormat(jaar1)#
    </cfoutput> (Date 2)</h3>
    <I>The dates are not equal</I>
    </cfcase>
    <CFDEFAULTCASE>
    <h3>This is the default case</h3>
    </CFDEFAULTCASE>
    </cfswitch>
    </loop>
    Is there somebody who could help me? The yyy-mm-dd notation
    is usable in MySQL, but it is not a Coldfusion date I believe??
    (maybe?). Could that also be a problem?
    Hopefully somebody understands what I mean.
    Thank you in advance.
    Regards,
    Kabbi

    If qTest.LastRegisteredTime is this:
    20060507072033Z
    You can do this
    <cfset myDate = CreateDate(left(qTest.LastRegisteredTime,
    4),
    mid(qTest.LastRegisteredTime, 5, 2),
    mid(qTest.LastRegisteredTime, 7, 2)>
    For this part:
    And if the date has another (earlyer) year or a month value
    of two months earlier then the current month (in the same year)..
    Do this
    <cfif datediff("yyyy", mydate, now()) gte 1
    or
    ( datediff("m", mydate, now()) gte 2
    and year(mydate) is year(now())
    >
    do something

  • Sales Summary - Compare same weekday sales last year.

    Post Author: geoffh
    CA Forum: Formula
    I have a table storing invoices going back several years. I wish to calculate the total sales for yesterdays date, & compare it with total sales for the same weekday in the previous year. For example if it is Tuesday today, I need to calculate Mondays total sales (yesterday) & also Mondays total sales for the same week period last year.
    Date fields I have available are 'history.date_invoiced' (invoice date) , history.week_invoiced , history_year.invoiced. Sales values are history.sell_account & history.sell_cash.
    I'm new to crystal.......Using V 11.0.0.1282 . Any help would be greatly appreciated.

    Post Author: yangster
    CA Forum: Formula
    create a formula with the following informationnumbervar weeknumber_curr_year := datepart("ww", dateadd("d", -1, ));numbervar weekdaynumber_curr_year := datepart("d", , 1);  //assuming sunday is the start date of the week, change to 2 if monday isthose 2 variables will tell you the current week number and what day of the week you are after for the current yearnumbervar last_year := dateadd("yyyy", -1, currentdate);if year() = last_year and datepart("ww", ) = weeknumber_curr_year anddatepart("d", , 1) = weekdaynumber_curr_year then amt_field else 0put that in the details section and create a summary of the formula and you should have the total sum of sales for exactly the same week and day of week one year prior to yesterdaymaybe kai has a more simplified solution but that's what comes off the top of my head

  • Compare data from a table

    Hello, I am trying to compare data from one and the same table. In short I have:
         NAME     DTM     CHARGE
         Atanas     8/18/2012 9:33:23 AM     100
    Atanas     8/18/2012 9:33:23 AM     101
         Niki     8/18/2012 9:33:43 AM     200
         Niki     8/17/2012 9:34:10 AM     100
    Niki     8/18/2012 9:33:43 AM     201
         Niki     8/17/2012 9:34:10 AM     101
         Atanas     8/17/2012 9:34:29 AM      50
    Atanas     8/17/2012 9:34:29 AM      51
         Joro     8/18/2012 12:10:12 PM 400
         Joro     8/17/2012 12:10:21 PM 300
    Joro     8/18/2012 12:10:12 PM 401
         Joro     8/17/2012 12:10:21 PM 301
    And I want to sum CHARGE for each DTM for each NAME and present the difference in an additional column, the output should be like that:
    NAME     DTM     CHARGE DTM CHARGE DIFFERENCE
         Atanas     8/17/2012 9:33:23 AM     101 8/18/2012 9:33:23 AM 201 - 100
    Niki     8/17/2012 9:33:23 AM     201 8/18/2012 9:33:23 AM 401 - 200
    Joro     8/17/2012 9:33:23 AM     601 8/18/2012 9:33:23 AM 801 200
    the DTM will be always /sysdate - 2/ and /sysdate - 1/,
    Thanks in advance!

    It is not clear what you are trying to do, but it looks like:
    with sample_table as (
                          select 'Atanas' name,to_date('8/18/2012 9:33:23 AM','mm/dd/yyyy hh:mi:ss am') dtm,100 charge from dual union all
                          select 'Atanas',to_date('8/18/2012 9:33:23 AM','mm/dd/yyyy hh:mi:ss am'),101 from dual union all
                          select 'Niki',to_date('8/18/2012 9:33:43 AM','mm/dd/yyyy hh:mi:ss am'),200 from dual union all
                          select 'Niki',to_date('8/17/2012 9:34:10 AM','mm/dd/yyyy hh:mi:ss am'),100 from dual union all
                          select 'Niki',to_date('8/18/2012 9:33:43 AM','mm/dd/yyyy hh:mi:ss am'),201 from dual union all
                          select 'Niki',to_date('8/17/2012 9:34:10 AM','mm/dd/yyyy hh:mi:ss am'),101 from dual union all
                          select 'Atanas',to_date('8/17/2012 9:34:29 AM','mm/dd/yyyy hh:mi:ss am'),50 from dual union all
                          select 'Atanas',to_date('8/17/2012 9:34:29 AM','mm/dd/yyyy hh:mi:ss am'),51 from dual union all
                          select 'Joro',to_date('8/18/2012 12:10:12 PM','mm/dd/yyyy hh:mi:ss am'),400 from dual union all
                          select 'Joro',to_date('8/17/2012 12:10:21 PM','mm/dd/yyyy hh:mi:ss am'),300 from dual union all
                          select 'Joro',to_date('8/18/2012 12:10:12 PM','mm/dd/yyyy hh:mi:ss am'),401 from dual union all
                          select 'Joro',to_date('8/17/2012 12:10:21 PM','mm/dd/yyyy hh:mi:ss am'),301 from dual
    select  nvl(s1.name,s2.name) name,
            s1.dtm,
            s1.charge,
            s2.dtm,
            s2.charge,
            s2.charge - s1.charge diff
      from      (
                 select  name,
                         dtm,
                         sum(charge) charge
                   from  sample_table
                   where dtm >= trunc(sysdate) - 1
                     and dtm <  trunc(sysdate)
                   group by name,
                            dtm
                ) s1
            full join
                 select  name,
                         dtm,
                         sum(charge) charge
                   from  sample_table
                   where dtm >= trunc(sysdate)
                     and dtm <  trunc(sysdate) + 1
                   group by name,
                            dtm
                ) s2
              on s1.name = s2.name
    NAME   DTM           CHARGE DTM           CHARGE       DIFF
    Atanas 17-AUG-12        101 18-AUG-12        201        100
    Niki   17-AUG-12        201 18-AUG-12        401        200
    Joro   17-AUG-12        601 18-AUG-12        801        200
    SQL> SY.

  • Using md5 in a manul tabular form to compare if column value changed

    Version: Application Express 3.2.0.00.27
    Hello,
    I am creating a manul tabular form using apx_item in my select statment that is the source for the query in a report region. I am using a collection. The collection creation statement is:
        apex_collection.create_collection_from_query(
           p_collection_name => 'DELEG_COLL',
           p_query           => 'SELECT authid
                               ,empid empid
                               ,to_char(deldate,''DD-MON-YYYY'') deldate
                               ,delscope delscope
                               ,dellimits dellimits
                               ,subdelrights subdelrights
                               ,to_char(delexpiry,''DD-MON-YYYY'') delexpiry
                               ,to_char(datedelremoved,''DD-MON-YYYY'') datedelremoved
                               ,delremovalcomments delremovalcomments
                               ,delegator delegator
                               ,''O'' original_record
                               ,wwv_flow_item.md5(delscope, dellimits, subdelrights,
                                  to_char(delexpiry,''DD-MON-YYYY'') delexpiry,
                                  to_char(datedelremoved,''DD-MON-YYYY'') datedelremoved,
                                  delremovalcomments, delegator)
                               FROM tbl_delegations
                               where empid = v(''P12_EMPID'')',
           p_generate_md5     => 'YES');The above code is giving me an error in the function
    wwv_flow_item.md5(delscope, dellimits, subdelrights,
                                  to_char(delexpiry,''DD-MON-YYYY'') delexpiry,
                                  to_char(datedelremoved,''DD-MON-YYYY'') datedelremoved,
                                  delremovalcomments, delegator)It doesn't seem to like where I attempt to convert date column delexpiry and datedelremoved to a varchar. I am doing this as in the db they are dates and inorder to using the md5 function to compare if the values have changed and only update rows where the values changed.
    There error that I get is:
    ORA-20104: create_collection_from_query Error:ORA-20104: create_collection_from_query ParseErr:ORA-00907: missing right parenthesis
    In the collection I am trying to store the md5 hash result. I haved all the update and insert logic working expect for date type columns. THose give the above error.
    I thank you ahead of time for your assistance!
    A. Shalon

    Helen,
    Not sure I fully understand your goal.  We don't use "tasks" at all but if you are looking to have your workflow check certain valus and be able to send email messages to people based on whatever, then you can certainly do that (as long as your Sharepoint
    has the email setup.  We do this for alot of workflow tasks.
    So, in the workflow you can have a blanket statement like what I previously listed:
    if Current Item:hiddenStatus  not equals Current Item:Status
        .... do something
    or you can do something like:
    if Current Item:hiddenStatus equals "In-Progress"
        .... do something
    Else if Current Item:hiddenStatus  equals "Completed"
        .... do something
    or combine the two and do nested "if" statements.  Then you add an email statement wherever you need it like:
    if Current Item:hiddenStatus  equals "Completed"
       then email "these users"
    To add the email part, just type in "email" on the line where you want to add a statment.  There is only one option to choose from.  That will display the line "then email these users".   The "these users" will be a link.  When you
    click it you will get a popup to add the email info.  We typically will send the email to a user (or users) that are already listed in one of the PeoplePicker fields.  On the email form, you can type in your own text, designate that a value is based
    on a column value (like our PeoplePicker), designate that a value is based on a workflow variable, add a link to the current item, etc.  To get to these options you will click the button to the right of the fields or use the "Add or Change Lookup" button
    in the bottom-left for the text area.  There is alot you can set in the mail.
    Does this help answer your question?
    - Peter

  • How to compare 2 dates in a JPA QL query

    hello all,
    how can i compare 2 dates in JPA QL ,?
    my idea was to convert the dates to String, and i used 'to_char',
    but i think it doesn't work in JPA QL;
    this is my query(it works in oracle but not in java) :
    Query q=em.createQuery("select sum(o.montant) from Operation o join o.codTransac t join o.codCaisse c where (t.sens='D')and (to_char(c.dateCaisse,'MM/DD/YYYY')=to_char(o.dateOp,'MM/DD/YYYY'))");
    can some one help me?
    thanks

    I don´t know if it´s the same case, but I had a similar problem and I`m posting here the way I solved it (maybe it isn´t the best solution but worked to me).
    I have to compare a date come from a web form (format dd/mm/yyyy) with a Timestamp data from DB (dd/mm/yy hh24:mi:ss).
    Solution:
    //String dateTo from web form
    //Substring here were used to get only dd/mm/yy from DB and ignore the hours
    ql.append(" SELECT o FROM Table o WHERE SUBSTRING(o.dateTime,1,8) = :end ");
    q = getEntityManager().createQuery(ql.toString());
    q.setParameter("end",convertStringToDateSimple(dateTo));
    //function used to parse the String date and return in an appropriate format expected in the above query
    public static String convertStringToDateSimple (final String source)
         final SimpleDateFormat format = new SimpleDateFormat("dd/MM/yy");
              String parsed = null;
                   try
                        parsed = format.format(format.parse(source));
                   catch (ParseException e)
                        throw new RuntimeException(e);
              return parsed;
    Edited by: user8947239 on 31/10/2011 10:58

  • Date fields and compare and get the later date of the fields

    I am trying to compare these date fields and compare and get the later date of the fields
    Tables are
    TABCASER
    TABCASER1
    EVCASERS
    Field
    Are
    TABCASER1.CASER_no
    The dates are to be compared and then get the records with the highest or latest date value.
    TABCASER1.CASERRECIEVEDDATE
    EVCASERS.FINALEVDATES
    EVCASERS.PUBLICATIONDATE
    EVCASERS.PUBLICATIONDATE
    TABCASER.COMPAREACCEPDATE
    I have this code but I am trying to figure out what it all means.
    I have several questions.
    1.
    1.     greatest it is used here to compare right? How do I then output this ? do I store it to a var (coldfusion) ultimately , I wish to send it to a page of records
    2.     is it necessary to use todate? And to_date? What does this do?
    3.     decode, is this necessary too. What does this do? NULL?
    4.     
    5.     
    6.     when I do get the query results how do I send it to coldsuion and out put to a display.
    Someone sent me this code.
    is there abetter way of doing this? To compare the dates and store in a var to display. thanks
    Here is my code below:
    Greatest(
         CASE
              WHEN INSTR(TABCASER1.CASER_no,'-CE') > 0 THEN
         decode(TABCASER1.CASERRECIEVEDDATE,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),TABCASER1.CASERRECIEVEDDATE)
                             WHEN INSTR(TABCASER1.CASER_no,'-ERNIE') > 0 THEN
         decode(EVCASERS.FINALEVDATES,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),EVCASERS.FINALEVDATES)
                             WHEN INSTR(TABCASER1.CASER_no,'-MONIE') > 0 THEN
         decode(EVCASERS.PUBLICATIONDATE,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),EVCASERS.PUBLICATIONDATE)
                             WHEN INSTR(TABCASER1.CASER_no,'-NADINE') > 0 THEN
         decode(EVCASERS.PUBLICATIONDATE,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),EVCASERS.PUBLICATIONDATE)
                             ELSE
         decode(TABCASER.COMPAREACCEPDATE,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),TABCASER.COMPAREACCEPDATE)
                        END
              ,decode(TABCASER.COMPAREACCEPDATE,NULL,TO_DATE('01/01/1900','mm/dd/yyyy'),TABCASER.COMPAREACCEPDATE))
              between TO_DATE('#dateformat(form.startDate,"mm/dd/yyyy")#','MM/DD/YYYY') and TO_DATE('#dateformat(form.endDate,"mm/dd/yyyy")#','MM/DD/YYYY')
    is there abetter way of doing this? To compare the dates and store in a var to display. thanks

    Hi
    If you have date datatypes than:
    select
    greatest(TABCASER1.CASERRECIEVEDDATE, EVCASERS.FINALEVDATES, EVCASERS.PUBLICATIONDATE, EVCASERS.PUBLICATIONDATE, TABCASER.COMPAREACCEPDATE)
    from TABCASER, TABCASER1, EVCASERS
    where ...-- join and other conditions
    1. greatest is good enough
    2. to_date creates date dataype from string with the format of format string ('mm/dd/yyyy')
    3. decode(a, b, c, d) is a function: if a = b than return c else d. NULL means that there is no data in the cell of the table.
    6. to format the date for display use to_char function with format modell as in the to_date function.
    Ott Karesz
    http://www.trendo-kft.hu

  • How to convert date from "yyyymmdd" to "MM/DD/YYYY" format

    1. I have one BLDAT field in my internal table.
       its getting updated from input file.
    2. The value in the input file is like yyyymmdd.
       So the internal table field is filled like this
       "YYYYMMDD".
    3. After this,I have to compare this internal table  
       field with BSAD table.
    4. The BLDAT field in BSAD table is in the format of 
       "MM/DD/YYYY".
    5. the BLDAT field is having diff format in internal  table and BSAD table.So I am unable to check this value.
    How to convert it as like the BSAD table format."MM/DD/YYYY" format.
    Thanks in advance!!

    Using the WRITE statement
      data: gd_date(10).  "field to store output date
    * Converts date from 20020901 to 09.01.2002
      write sy-datum to gd_date mm/dd/yyyy.
    OR u can
    CONCATENATE gd_date+4(2) gd_date+6(2) gd_date+0(4)
    into gd_date seperated by '/' .
    Hope this helps.
    Kindly reward points and close the thread for the
    answer which helped u OR get back with queries.

  • Converting Date.toString() back to a Date object for compare

    I know this is beating a dead horse to death but I have wasted a whole day trying to get this to work. Here is the problem.
    I need to convert a Date().toString (format returned: Dec 19, 2006 3:39:58 PM EST) back to a Date object. What I am doing is writting this string a text file and then revisiting it to compare later to a current Date object to find the difference in the two stamps in milliseconds.
    J2SE 1.4.2 being used
    Date date = new Date();
    String newDateStr = log[1].trim(); // entry from log file
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date logDate = dateFormat.parse(newDateStr);
    // get difference between the two
    long timeSpan = date.getTime() - logDate.getTime();
    if(timeSpan > 60000){
        // TO DO
    }So should I look at a different approach at either:
    A) Storing the date/time stamp in the text file
    B) The conversion back to Date object is wrong
    Really appreciate any insight on this.
    Thanks
    JLW
    Message was edited by:
    jlwestsr

    Then my friend you are in the same status as Tim.:o)
    I don't know as much as him and I don't care to write
    an elaborate reply most of the time. :D
    Merry ChristmasSame to you.I don't pretend to know that much, but When I see something I do know, I tend to give examples.
    Most probably that is because at the present time I am in a situation where most of my time is spent waiting for a call from the customer, and the app I am supporting works so well that those calls are few and far between. Lucky for me, they pay me for sitting around and answering questions on a forum.
    At least it is a java forum, where I can justly claim that I am improving my knowledge of java.
    ~Tim

  • Validating a text field that has date in the format mm/dd/yyyy

    How can I validate a text field such that it should be in the format mm/dd/yyyy and it should not be greater that a particular date.
    for example the date I enter should not be greater than 01/01/2007

    What you can do is use the SimpleDateFormat class to try and parse the text date into a Date object like this:
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    Date mydate = sdf.parse(textdate);if that fails than the date has the wrong format (you'll get a ParseException if I'm not mistaken).
    The next step is to create a Date for 1/1/2007 and then do a date compare between your two dates. You can create a date yourself using the Calendar class.

Maybe you are looking for

  • Unable To Watch Flash From Hulu

    I noticed that I am unable to watch anything from Hulu.com only on my Arch Linux machine. It's a 64bit PC running Firefox and I can watch Youtube or any other video site that has embedded flash players except www.hulu.com. I attempt to pull up any vi

  • My daughter forgot her password she set up and now we can not get into it.  What do I do?

    How do i get into her touch to reset the password or even disable it so she can not do it again?

  • Password synchronization between OID and AD - 10.1.2

    Hi, I've some questions about the following issue: I've tried to setup the password synchronization between OID 10.1.2 and active directory, with the intent of exporting ldap users from OID to AD.. Well, the bootstrap gone fine, but when I tried to a

  • RFC dynamic Language Selection

    Hi Would it be possible to change language during runtime for applications using adaptative RFC in Webdynpro? I suppose that runtime language for RFC dictionary (labels, messages, etc) is based on JCO language selection. Would it be possible to chang

  • Lync for Mac - VCS Interop

    Hi, We're testing a Lync - VCS interop setup and I noticed in the VCS - Lync deployment guide that Lync for Mac requires an Advanced Media Gateway for Video calls. Is the AM GW still required? We can get Audio & Video from Lync 2013 on Windows via th