How to Compare date with Current system date in XSLT mapping.

Hello Experts
In a XSLT mapping program, I hava a filed, ZZOB which is giving some date.
which I need to compare with the current date.
Condition-
ZZOB is greater than current date or ZZOBLIG = NULL
Then go further statements.
how can i campare with the current date?
Please help.
Thanks
Balaprasad

This example may help:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="currentDate"/>
    <xsl:variable name="firstDate" select="concat(substring($currentDate, 1,4),substring($currentDate, 6,2),substring($currentDate, 9,2))"/>
    <xsl:template match="/">
        <xsl:apply-templates select="//item"/>
    </xsl:template>
    <xsl:template match="item">
        <xsl:variable name="secondDate" select="concat(substring(submissionDeadline, 1,4),substring(submissionDeadline, 6,2),substring(submissionDeadline, 9,2))"/>
        <xsl:choose>
        <xsl:when test="$firstDate &gt; $secondDate">
            <xsl:call-template name="late"/>
            </xsl:when>
            <xsl:when test="$firstDate &lt; $secondDate">
                <xsl:call-template name="ontime"/>
            </xsl:when>
            <xsl:when test="$firstDate = $secondDate">
                <xsl:call-template name="same"/>
            </xsl:when>
            <xsl:otherwise>Monkeys<br /></xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <xsl:template name="ontime">
        This is on time
    </xsl:template>
    <xsl:template name="late">
        This is late
    </xsl:template>
    <xsl:template name="same">
        This is on time
    </xsl:template>
</xsl:stylesheet>

Similar Messages

  • How to compare date in xslt

    hi
    i need to compare the date in xslt . i was not able to get the current date in xslt.. so i entered through parameter by java. now i have the current date and in xml i have two field fromdate and todate i need to compare that some data should display when current date comes between fromdate and todate. can u tell me how to do it .
    try to provide some code....
    i was looking for some format date function but could get it
    xsl:if test="data/fromdate > currdate and date/todate < currdate"
    it is not working becouse i am not able to convert my varriable to date type... may be
    please help
    anagh

    Hi,
    I am running into a same problem with xsl :-
    a) I need to generate the current date and store it in a field
    b) I have a date field with a End date entered by the user..
    I need the xslt to minus the current date from the enddate and show the number of days / weeks left.
    How can i do this ?
    Rgds,
    Manoj

  • How to compare date which is greatest date

    iam new to sql
    how to compare date which date is greatest date with example
    can i use to_char to compare date
    SELECT eno, ename, GREATEST (TBLE.MAX1, TBLE.MAX2) recent_date "
                   FROM (SELECT TBLA.eno, TBLA.ename, "
                   MAX (TO_CHAR (TBL.date1, 'MM/DD/YYYY HH24:MI') "
                   ) MAX1, "
                   MAX (TO_CHAR (TBL.date2, 'MM/DD/YYYY HH24:MI') "
                   ) MAX2 "
                   FROM dual TBL, dual2 TBLA
    in above query if any one of the date having null value then recent_date is showing 'null'
    and also it showing wrong value
    example
    date1='08-22-2009' and date2='01-23-2010' then it showing wrong recent_datel ike='08-22-2009'
    as according my knowledge it is comparing with month it sholud not be like this wat i have to do pls explain with example my o/p should come for recent_date like =''01-23-2010''
    Edited by: user9112274 on Aug 27, 2010 5:31 AM

    Hi,
    there are numerous ways to compare dates, i give you some examples:
    with data_Sample as
    (select to_date('01-jan-2001','dd-mon-yyyy') d1, to_date('01-mar-2002','dd-mon-yyyy') d2, to_date('03-feb-2002','dd-mon-yyyy') d3 from dual)
    select greatest(d1,d2,d3) from data_Sample
    GREATEST(D1,D2,D3)
    3/1/2002
    with data_Sample as
    (select to_date('01-jan-2001','dd-mon-yyyy') d1 from dual union all
    select to_date('01-mar-2002','dd-mon-yyyy')   from dual union all
    select to_date('03-feb-2002','dd-mon-yyyy')  from dual)
    select max(d1) from data_Sample
    MAX(D1)
    3/1/2002
    declare
    d1 date :=to_date('01-jan-2001','dd-mon-yyyy');
    d2 date :=to_date('01-jan-2001','dd-mon-yyyy');
    begin
    if d1>d2 then
    dbms_output.PUT_LINE('d1 greater than d2');
    else
    dbms_output.PUT_LINE('d1 less or equql than d2');
    end if;
    end;
    output:
    d1 less or equal than d2now concerning your question:
    >
    can i use to_char to compare date
    >
    If you have date data types : don't convert them.
    if you have no choice, use something like:
    if to_char(d1,'YYYYMMDD') > to_char(d2,'YYYYMMDD') then
    else
    end if;Take care when you convert a date into a char format it becomes string comparison (with all it implies) (It's the reason why i've use an explicit mask format).

  • How to compare date and time together

    Hi,
    How to compare Date and Time together?
    For example in a database table there are two fields rundate and runtime.  I want to compare these two with perticular date and time in the program.  Like, I want to pull all the records where the records's date and time are less than a perticular date and time in the program.
    Hope the question is clear...
    Thanks.
    Kavita

    Hi Kavita
    There is no as such Date and Time Comparision FM in Standard SAP  But You can define your own like this
    <b>FUNCTION ZAV4_COMPAREDATETIME.
    ""Lokale Schnittstelle:
    *"  IMPORTING
    *"     REFERENCE(DATE1) TYPE  DATS
    *"     REFERENCE(TIME1) TYPE  TIMS
    *"     REFERENCE(DATE2) TYPE  DATS
    *"     REFERENCE(TIME2) TYPE  TIMS
    *"  EXPORTING
    *"     VALUE(TWOISMORETOPICAL) TYPE  C
      twoismoretopical = ''.
      if date2 > date1.
        twoismoretopical = 'X'.
      else.
         if date2 = date1 and time2 > time1.
           twoismoretopical = 'X'.
         endif.
      endif.
    ENDFUNCTION.</b>
    Regards
    Mithlesh

  • How we can view convert data after XSLT mapping & before Graphical mapp

    Hello Friends,
    Currently i am working on XI standard content. In this client need some customization.
    In interface mapping, XSLT mapping on 1st position & Graphical mapping on 2nd position.
    As per my understanding 1st XSLT mapping will be exected then Graphical mapping.
    Can I see or check convert data from XSLT mapping.
    I want to check data between XSLT mapping & Graphical mapping.
    Kindly help me out.
    Regards,
    Narendra

    >
    Narendra GSTIT wrote:
    > I dont want to test standalone XSL Code.
    >
    > The data which I get from Source interface and after XSLT mapping I want to check this that my XSLT code is going well or not.
    >
    > i.e. check for proper input & get proper output.
    You have ro do standalone testing of the XSLT mapping.....Interface Mapping or Interface Determination will give you output message which will be that of message mapping (the last mapping)
    What is the issue in testing the XSLT mapping alone?...may be in Stylus Studio.
    Just ensure that XSLT mapping produces proper output and then this output message of XSLT is the input to your Message Mapping.....once the entire Interface mapping gets executed then it would mean that all the included mapping programs work fine.
    Regards,
    Abhishek.

  • Compare previous with Current Value

    Want to compare previous with current value and assign the right one..
    COLA COLB
    72 21356
    41023 21356
    90 78903
    90 89078
    90 78956
    90 45632
    41023 78903
    41023 45632
    Output I want is:
    COLA COLB
    72 21356
    72 21356
    90 78903
    90 89078
    90 78956
    90 45632
    90 78903
    90 45632
    Anytime the value in COLA is 41023, I need to look at value in COLB and compare it with the rest of values and assign the COLA value that is NOT 41023
    Thanks...

    Not sure but here a try :
    SQL> select * from tbltbl;
          COLA       COLB
            72      21356
         41023      21356
            90      78903
            90      89078
            90      78956
            90      45632
         41023      78903
         41023      45632
    8 rows selected.
    SQL> MERGE INTO tbltbl a
      2  USING (select c.cola,b.rowid rwd
      3         from   tbltbl b,
      4                tbltbl c
      5         where  b.cola=41023
      6         and    b.colb=c.colb
      7         and    c.cola!=41023) d
      8  on    (a.rowid=d.rwd)
      9  WHEN MATCHED THEN UPDATE set a.cola=d.cola;
    3 rows merged.
    SQL>
    SQL> select * from tbltbl;
          COLA       COLB
            72      21356
            72      21356
            90      78903
            90      89078
            90      78956
            90      45632
            90      78903
            90      45632
    8 rows selected.Works only if colb is unique for non 41023 value.
    Nicolas.
    Oh, very very late.
    Edited by: N. Gasparotto on Oct 3, 2008 5:05 PM

  • How to show two different plots with current system time and date on waveform chart

    I am using  one waveform chart to display the more than one value continiously. The data  are comming properly but i am not getting my system (pc) time and date on x axis. It is showing default date and time (i.e.01/01/1904 5:30:45). Please  give me suggestions to display the real time and date on x axis of waveform chart. 

    How does your data look like? Do you graph waveform data types, dynamic data, or plain arrays/clustes? In the case of plain arrays, you need to set x0 to the absolute start time of your data, e.g. with a property node.
    I you would attach your code (or an image) we could offer more specific advice. There are too many possibilities.
    LabVIEW Champion . Do more with less code and in less time .

  • Compare Hiredate with Current date in PCR

    As per the requirement I have, a certain type of accrual needs to occur on the employee's anniversary date, this accrual should only happen on the first anniversary. How can I compare hire date with current date ignoring the year, and then ignoring the same logic from second year on-wards.
    Can someone please help me with the possible method of implementing this requirement in a time PCR.

    In my humble opinion, I think that you should achieve that by means of an ABAP program, it should be scheduled to run every day and compare the hiring date with the current date of every employee, then create a batch input to Infotype 2013... it would be easier to track and monitor, since you would have all logs in SM35
    Best regards,
    Federico.

  • How to compare Date in the TextField or DateTime with Date/Time field?

    Hi All,
    I am facing an issue with respect Date comparinson. I tried to look into entire discussions but failed to get the answer.
    My issue is: I wanted to comparet Date/time field value with Date value which is in TextField.
    The functionality of my form is:
    I have dropdown list which lists the registered customer ids binded to XML Datasource. On selection of the customer id from the dropdown I am displaying customer registration date in the TextField or say Date/Time field as below code in dropdown change event.
    RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value; (this is TextField control)
    In form I have an Date/Time field in which use will select the date of item purchase. In the validation part I want to make sure that, the purchase date selected in Date/Time field must be greater than the Customer Registraiton Date. I able to compare if the customer selects the date from two different Date/Time fields. But how to compare the dates which one is in Date/Time field and Date is in TextField?
    I have tried using Num2Date and Date2Num with "YYYY-MM-DD"  format to compare but not succeed!
    Can you guys help me in this? Thanks in advance
    Regards.

    Hi,
    Yes, I am able to display the date which I have assigned to the text box. In the message box it show the value as '31/05/2009', since in this format i am assigining the date in the text box.
    Here is the code which I am assigning the value:
    RegistrationDetails.PurchaseEntry.txtRegDate.rawValue = regDataNode.CREATION_DATE.value;
    Do I need to change the format while assigning value in text box?
    You have told that, you have attached your test form, nothing is the reply. Can you repost the file?
    Regards.

  • How to compare date with char

    hi
    i am having date from and date to feilds in my overtime element.i want to do the validation on these dates the the dates do not overlap or duplicated.the input value date from and date to are stored in database as varchar2 in the format yyyy/mm/dd 00:00:00. Now if i am trying to compare entered date with these dates i am getting literal does not match format string or date picture ends before....Can any body tell me what to do.
    Regards

    user10502390 wrote:
    hi
    i am having date from and date to feilds in my overtime element.i want to do the validation on these dates the the dates do not overlap or duplicated.the input value date from and date to are stored in database as varchar2 in the format yyyy/mm/dd 00:00:00. Now if i am trying to compare entered date with these dates i am getting literal does not match format string or date picture ends before....Can any body tell me what to do.
    RegardsPoint a) VERY BAD IDEA storing dates as VARCHAR2 on the database. It will only lead to corrupt data in the future.
    Point b) When comparing dates, you should compare them as DATE datatype as the database knows how to do comparisons against DATES. If you try and compare them as VARCHAR2 then you will most likely end up with incorrect comparisons.
    If you must have varchar2 storing of your dates/times (there's absolutely no reason to though)... you want...
    TO_DATE(:entered_date,'YYYY/MM/DD HH24:MI:SS') BETWEEN TO_DATE(DATEFROM,'YYYY/MM/DD HH24:MI:SS') AND TO_DATE(DATETO,'YYYY/MM/DD HH24:MI:SS')
    e.g.
    TO_DATE('20080815 13:23:33','YYYY/MM/DD HH24:MI:SS') BETWEEN TO_DATE(DATEFROM,'YYYY/MM/DD HH24:MI:SS') AND TO_DATE(DATETO,'YYYY/MM/DD HH24:MI:SS')

  • Want to shedule a report in background with current system date

    Dear All,
    I want to schedule a report which is having date parameters in the  selection screen.
    What i want is that , every time in the schedulling period the report should run in current system date only with a variant.
    Would it be possible.
    Thanks in Advance.
    With Regards
    Shantanu

    Yes possible by 2 ways.
    I) This way you can use the current date dynamically
    Go to your variants in change mode,
    1. Check the box 'Selection Variable' for date.
    2. Click on selection variables
    3. Choose 'D' for dynamic date calc
    4. Choose current date and save.
    II)Default it in code
    Default sy-datum for the selection variable.
    Hope this helps.

  • Export Preset to Rename with Current system Date?

    Hi All,
    I'm trying to build some export presets with a naming convention to include the current system date, eg: YYYYMMM-Title-Custom Text. This convention is oftened required for photo club, local, national & international photo competitions. The only date function I can find is the 'capture date'. Is there a way to modify the Export Filename Template Editor to include 'current system date' ??
    Edit:
    Sorry forgot to add, LR5.3, Mas OS 10.9.1
    Regards
    Craig

    You need to click the 'Define' button and choose Date/Time Now (Custom Metadata):
    If you need more help, please contact me outside the forum - thanks.
    Rob

  • How to compare data between two worksheet in Excel for applescript

    Hi All,
    How to compare the data from two different worksheet in Excel and set the value into one worksheet according to the same name? Here is the example. Worksheet 1 & 2 current we have, the final worksheet is the result we want and the value can be input in worksheet 1. Much appreciate if you can help on it.
    Worksheet 1:
    Name          Number
    Leo                 25
    Jame               55
    Leo                 30
    Jame               60
    Tim                 44
    Tomas             77
    Lyne                35
    Tonny              66
    Jame               22
    Game              88
    Worksheet  2:
    Name          Number  2
    Leo                60
    Jame             150
    Tim                66
    Tomas            88
    Lyne               55
    Tonny            99
    Game             111
    Rusult in Worksheet 1
    Name          Number        Total Number per name in Worksheet 1         Number 2 in Worksheet 2
    Leo                 25                          55                                                        60
    Jame               55                         137                                                       150
    Leo                 30                           55                                                        60
    Jame               60                         137                                                       150
    Tim                 44                          44                                                         66
    Tomas             77                          77                                                        88
    Lyne                35                          35                                                        55
    Tonny              66                          66                                                        99
    Jame               22                         137                                                       150
    Game              88                          88                                                        111

    I'd probably use a database for this, if there's any quantity of data involved here.  Import from Excel into {SQLite, MySQL, PostgreSQL, FileMaker, maybe Core Data}, or pick your preferred key-value store, keep your data in the database, then export or (via ODBC/JDBC) then access live database data from within the spreadsheets.
    Alternatively and if you're looking at small quantities of data (say, less than 10,000 entries, or less than a thousand depending on the language), then just use whatever passes for a key-value store in your preferred scripting language {Python, bash, Lua, or maybe php, AppleScript or Java} and use that.  Export Excel to CSV {gag} or XML, then load that into Python and process as needed, then write out CSV {gag} or XML.
    AppleScript is a scripting language for GUI applications, and also useful for processing events.  If you're not doing that sort of stuff, then there can be other choices, and other choices can often have extensive frameworks and libraries for common tasks.
    Sooner or later, most everybody runs into a wall when using a spreadsheet...  Various folks have encountered those limits and have migrated from spreadsheets to FileMaker databases, and now use a database as the central store for their operations — and that's the other issue that can arise with spreadsheets... Where's the canonical data?

  • How to compare dates

    i know it writes somewhere in the API but its so hard to solve the API so my question is
    i have a date in String type such like 02-03-2002
    and i want compare it with the current time, if it is before today's date. how can i do that? what is the method of Date class for comparison and what must be the data type for it? also in what format tha date must be?
    thanks...

    Use a StringTokenizer to get the individual fields of date.
    For example, ur date is : "02-03-2002".
    Using StringTokenizer, u shall get individual fields of the above date (02, 03, 2002).
    Using Integer.parseInt(int) method, get the int for each field.
    Now use the Calendar object.
    Calendar myCalendar = Calendar.getInstance();
    Set the Year, month and day u have obtained above, using the Calendar method myCalendar.set(...) //Refer to API for more details.
    In the set method, set the time for minutes, hrs and seconds to 0, otherwise the time would be set to current time.
    Now to get the date from Calendar, use:
    java.util.Date myDate1 = myCalendar.getTime();
    Get myDate2 in similar fashion.
    Now, u can use after(...), before(...), compareTo(...) etc APIs of java.util.Date for comparing the dates.
    Manish.

  • How to compare dates in Crystal Reports 2008

    Hello,
    I cannot figure out how to compare the dates in the Crystal reports.
    I need all dates that are in the future to be displayed with the green font.
    So in the formula for the font for this texbox I've tried to use different
    formulas like:
    If DateDiff("d", CurrentDate, {DevelopmentTracking_SELECT.Anticipated}) > 1
    Then
         crGreen
    or
    If {DevelopmentTracking_SELECT.Anticipated} > CurrentDate Then
         crGreen
    (where DevelopmentTracking_SELECT is the stored procedure, and Anticipated
    is a date field).
    None of them worked. All dates are treated like they were in the past
    comparing to the CurrentDate. If I reverse these formulas like:
    If {DevelopmentTracking_SELECT.Anticipated} < CurrentDate Then
         crGreen
    then all dates turn to green, otherwise they always stay black.
    What could be a problem here?
    I would appreciate your help.
    Thank you.

    OK, got it, thank you. It worked.
    However, I also need to use another field value which is not on the report, like this:
    If CurrentFieldValue < CurrentDate And {DevelopmentTracking_SELECT.Completed} = False Then
    crRed
    DevelopmentTracking_SELECT.Completed is not on the report.
    Is it possible to use it with the cross-tab?

Maybe you are looking for