Data Comparison using Openscript

Hi, Is it possible to compare 2 html/xml/pdf page's format and data using Openscript
Edited by: 887085 on Sep 23, 2011 8:07 PM

Hello Ash,
Please check CCDB functionality if it suits you:
Configuration and Change Database (CCDB) - SAP Solution Manager - SAP Library
BR,
K.

Similar Messages

  • Date comparison using between function

    we are extracting the data between two dates and time with the below mentioned SQL. this same SQL extract different no of records with the same data on two different AIX server
    Both the database on the same version 9.2.0.8.0 and second is replica of first database.
    table column RCRE_TIME is date datatype
    SELECT AST.OPERATION,
    AST.CUST_ID,
    AST.RCRE_TIME,
    AST.KEY,
    HAC.ACCT_CLS_FLG,
    FROM HAC,AST
    WHERE HAC.FORACID = AST.KEY
    AND HAC.ENTITY_CRE_FLG = 'Y'
    AND to_date(AST.RCRE_TIME,'DD-MM-YYYY HH24:MI:SS') BETWEEN to_date('12-03-2012 20:22:28','DD-MM-YYYY HH24:MI:SS') AND to_date('13-03-2012 21:25:20','DD-MM-YYYY HH24:MI:SS')
    can any one help on the same.
    Thanks
    RSG

    user8448799 wrote:
    we are extracting the data between two dates and time with the below mentioned SQL. this same SQL extract different no of records with the same data on two different AIX server
    Both the database on the same version 9.2.0.8.0 and second is replica of first database.
    table column RCRE_TIME is date datatype
    SELECT AST.OPERATION,
    AST.CUST_ID,
    AST.RCRE_TIME,
    AST.KEY,
    HAC.ACCT_CLS_FLG,
    FROM HAC,AST
    WHERE HAC.FORACID = AST.KEY
    AND HAC.ENTITY_CRE_FLG = 'Y'
    AND to_date(AST.RCRE_TIME,'DD-MM-YYYY HH24:MI:SS') BETWEEN to_date('12-03-2012 20:22:28','DD-MM-YYYY HH24:MI:SS') AND to_date('13-03-2012 21:25:20','DD-MM-YYYY HH24:MI:SS')
    can any one help on the same.
    Thanks
    RSGsame results occur when everything is the same.
    different results occurs when something is different.
    How can we reproduce what you report?

  • Data Comparison using solution manager

    Hi All,
    Can anybody please let me know if there is any tool available in Solution Manager(SP 10) for the following case.
    I need to check if a value of a certain field in a table on ECC has changed by say 10% between two days(or between 2 runs). If for eg the value in today's run is 10, I need to be know if the value has changed to greater than 11 or less than 9 in tomorrows run.
    Can I temporarily store the values of todays run and then compare the value with tomorrows run??
    Regards,
    Ash

    Hello Ash,
    Please check CCDB functionality if it suits you:
    Configuration and Change Database (CCDB) - SAP Solution Manager - SAP Library
    BR,
    K.

  • Question on How to Use LI and NP Data Comparison Report

    Hi,
    We are trying to figure out how to make the Transaction Code PC00_M42_LLPD (LI and NP Data Comparison Report) work. What file type (.xls, .txt, etc) should be used?  Anyone who is familiar with the transaction, please help.
    Best Regards,
    Bry

    Somewhere in the Oracle 8.0 documentation it is stated that one
    enviroment per each thread is required if I want to ensure
    complete concurrency of different threads accessing databases.
    But isn't this a waste of resources since only Handle Alloc &
    Free functions use Enviroment handle, hence they should be
    mutexed for access from concurrent threads.
    But the most time-consuming functions are ServerAttach &
    SessionBegin which shouldn't be mutexed since they have each
    their own Server/Session handle.
    So my question is if a single OCI Enviroment is enough for the
    most demanding tasks or should I create one enviroment per
    thread?
    Most folks are happy with a single environment. The mutex on the
    env handle is only taken when the OCI library is allocating some
    memory for internal operations.
    Tomislav.

  • Report customer master data comparison

    Hello Experts,
    Using transaction SE38, we would like to run report customer master data comparison. Could anyone provide the report name?
    Thank you

    Hi Thanks.
    Can you provide report used for sales summary?
    Thanks again

  • Idoc data  comparison between different R/3 clients.

    Hi ppl ,
    Is there a way idoc comparison can be done between different clients without going
    by Segment by Segment comparison ?
    I have a requirement wherein i have thousands of idocs in QA system and i need to
    compare those with the ones in PROD system. The segments in the idocs may vary
    depending on the data that flows from the third party system which will post idocs in R/3.
    So, the segment wise comparison of data is also ruled out .
    Do we have any standard reports which will help in achieving this purpose ?
    Please let me know how the idoc data comparison can be carried out .
    Regards,
    Nick.

    Hi Nick,
    There is no standared tools available for comparing the data of two idocs.
    By using beyond compare s/w you can check the data, but the thing is you have to download the idoc data to file format.
    By using Idoc_xml_transform function module you can download idoc data to xml format, after you can compare.
    Check this
    http://download.cnet.com/Beyond-Compare/3000-2242_4-10015731.html
    Regards
    Ramesh

  • OBIEE Date Comparison report with multiple measures

    Hello everyone...
    I have a requirement where I need to create a date comparison report (Current Month vs. Prior Month vs Prior Month Year Ago vs YTD vs Prior YTD vs Rolling 3 months, etc) with multiple Measures (Quote count, Quote offered count, New Business count, etc). I am to generate this report in this fashion:
    Quotes Current Month vs PM vs YoY Prior
    Month Current Month Prior Year Current
    YTD vs PM Prior
    YTD Rolling 3 Months vs PM Prior Rolling 3 Months
    Issued 120 120 123 1400 1020 1700 1580
    Unique Risks
    Offered 556 449 571 5881 6220 6101 5892
    Unique Risk Close Ratio
    Offered Close Ratio 21.6% 26.7% 21.5% 23.8% 16.4% 27.9% 26.8%
    Bitmap
    Avg Issued Premium 240 238 222 2801 2630 3104 2892
    Avg Offered Premium
    New Business
    Count
    Avg Full Term Premium
    I understand that time series is an option, and have created the time series (which show up as measures).
    My problem is:
    when creating the report (even as a pivot table) , OBIEE is not allowing me to drag the measure to rows, nor is it allowing me to drag the time series to columns. Also, I need to do conditional formating on some of the columns showing an up arrow for increased vs. prior month and down arrow for decreased vs. prior month.
    Does anyone have a solution for this issue? Any assistance would be greatly appreciated...
    Please advise and thanks!!!

    Jason,
        You've been very helpful, but I guess I'm just not explaining myself that well. The Credit Memo's throw things off because they do not contain a "Paid Date" value. That field in the record is blank. Since it is blank the report query ignores them. Therefore when the report query returns all records that have a "Paid date" range of "x to y" they are never returned. This is a problem whenever a credit memo exists for an invoice because the "invoice total" never changes. So when a customer pays on their account for a particular invoice, they only pay what is due which is the "invoice total" minus any "credit" from the "Credit Memo". So when my A/R person receives payment they are showing the invoice paid in full because MAS automatically includes all invoices and credit memo's. My report does not because there is no data in the "Paid Date" field of the record for Credit Memos.
    I've been doing alot research in trying to resolve this "exception" to my report. I think I may be on to something, but my knowledge of arrays is extremely limited. My resolution involves populating an array with the "invoice numbers" that are returned from the initial query from the supplied date range. Then using the "invoice numbers" from the array have it then populate my details section of the report with all of "invoice records" both the actual invoice record and any "credit memo" records. I can then group the records returned  based upon the "invoice number". then within that grouping I can performing my calculations to show whether or not the invoice has been paid in full. What do you think?  I've been able to populate an array with the invoice numbers based upon my date search range, but I have yet to figure out how to take that information and perform another lookup to pull in the rest of the data I need. Do you have any ideas?
    Thanks.  Bill

  • Date comparison question

    I was trying to write a report for any alerts that haven’t been assigned within 20 minutes. The date/time is stored in epoch format. I think I was able to work through that and get the time it took for an acknowledgement an alert (Time to Assignment). I was able to successfully add to pickup the last 7 days of alerts. But, I’m having problems with my comparison in the where clause where I want to select all alerts that were acknowledge over 20 minutes to ack. I've played around with various versions to_char without any success. Is there a better way to attack this?
    select to_char(DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * rawservertime, 'DD-MON-YYYY HH24:MI:SSSSS') "Alert Time",
    helpdeskid "Ticket",
    hostname,
    to_char(DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * rawagenttime, 'DD-MON-YYYY HH24:MI:SSSSS') "Assigned Time",
    to_char(DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * (rawservertime - rawagenttime), 'HH24:MI:SSSSS') "Time to Assignment"
    from em_events_tbl
    where to_char(DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * rawservertime, 'DD-MON-YYYY') > trunc(sysdate-7)
    and to_char(DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * (rawservertime - rawagenttime), 'HH24:MI:SSSSS') > *20 Minutes????*
    order by 1;
    Alert Time Ticket HOSTNAME Assigned Time Time to Assignment
    25-OCT-2011 19:20:69614 TT788209 servername 25-OCT-2011 18:59:68387 00:20:01227
    This is the Oracle version: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0

    Oracle date arithmetic uses day as unit if measure. Therefore 20 minutes is 1 / 72 ( 1/ 24 / 60 * 20). There are also many more errors in your code:
    select  to_char(DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * rawservertime, 'DD-MON-YYYY HH24:MI:SS') "Alert Time",
            helpdeskid "Ticket",
            hostname,
            to_char(DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * rawagenttime, 'DD-MON-YYYY HH24:MI:SSSSS') "Assigned Time",
            to_char(DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * (rawservertime - rawagenttime), 'HH24:MI:SSSSS') "Time to Assignment"
      from  em_events_tbl
      where DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * rawservertime > trunc(sysdate-7)
        and DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * rawservertime - DATE '1970-01-01' + ( 1 / 24 / 60 / 60 / 1000) * rawagenttime > 1 / 72
      order by 1;And why now simply:
    (rawservertime - rawagenttime) / 1000 / 60 > 20SY.

  • Data comparisons and movements

    I have a Heap Sort using the following code, and I cannot seem to figure out how many data comparisons and data movements there are as the heap is sorted. Does anybody know how to count the number of comparisons and movements?? Please let me know....much appreciated...Thanks :)
    import java.io.IOException;
    import java.util.*; // Calender Class for timing
    public class Heap {
    private MyNode[] heapArray;
    private int maxSize;
    private int currentSize; // number of items in array
    public Heap(int mx) {
    maxSize = mx;
    currentSize = 0;
    heapArray = new MyNode[maxSize];
    public MyNode remove()
    MyNode root = heapArray[0];
    heapArray[0] = heapArray[--currentSize];
    trickleDown(0);
    return root;
    public void trickleDown(int index) {
    int largerChild;
    MyNode top = heapArray[index];
    while (index < currentSize / 2)
    int leftChild = 2 * index + 1;
    int rightChild = leftChild + 1;
    // find larger child
    if (rightChild < currentSize
    heapArray[leftChild].getKey() < heapArray[rightChild]
    .getKey())
    largerChild = rightChild;
    else
    largerChild = leftChild;
    if (top.getKey() >= heapArray[largerChild].getKey())
    break;
    heapArray[index] = heapArray[largerChild];
    index = largerChild;
    heapArray[index] = top;
    public void displayHeap() {
    int nBlanks = 32;
    int itemsPerRow = 1;
    int column = 0;
    int currentIndex = 0;
    while (currentSize > 0)
    if (column == 0)
    for (int k = 0; k < nBlanks; k++)
    System.out.print(' ');
    System.out.print(heapArray[currentIndex].getKey());
    if (++currentIndex == currentSize) // done?
    break;
    if (++column == itemsPerRow) // end of row?
    nBlanks /= 2;
    itemsPerRow *= 2;
    column = 0;
    System.out.println();
    else
    for (int k = 0; k < nBlanks * 2 - 2; k++)
    System.out.print(' '); // interim blanks
    public void displayArray() {
    for (int j = 0; j < maxSize; j++)
    System.out.print(heapArray[j].getKey() + " ");
    System.out.println("");
    public void insertAt(int index, MyNode newNode) {
    heapArray[index] = newNode;
    public void incrementSize() {
    currentSize++;
    public static void main(String[] args) throws IOException {
    int size, i;
    size = 500;
    Heap theHeap = new Heap(size);
    for (i = 0; i < size; i++) {
    int random = (int) (java.lang.Math.random() * 5000);
    MyNode newNode = new MyNode(random);
    theHeap.insertAt(i, newNode);
    theHeap.incrementSize();
    System.out.println(size+" random numbers are currently being generated...");
    for (i = size / 2 - 1; i >= 0; i--)
    theHeap.trickleDown(i); // creates the heap
    System.out.print("\nRandom Numbers in a Heap: ");
    theHeap.displayArray(); // prints the heap
    long time1000start = new Date().getTime() ; // this makes a new Date object and then sets the long integer value of the Date object
    // ******************* START - sorting numbers *******************
    for (i = size - 1; i >= 0; i--)
    MyNode biggestNode = theHeap.remove();
    theHeap.insertAt(i, biggestNode);
    // ******************* END - sorting numbers *******************
    long time1000end = new Date().getTime() ; // this makes a new Date object and then sets the long integer value of the Date object
    double timediff1000m = (time1000end - time1000start); // difference of time in milliseconds
    double timediff1000s = ((time1000end - time1000start) / 1000); // difference of time in seconds
    System.out.print("\nRandom Numbers in a Sort: ");
    theHeap.displayArray(); // prints the numbers in increasing order
    System.out.print("\nStart Time of Sort: "+time1000start);
    System.out.print("\nEnd Time of Sort: "+time1000end);
    System.out.print("\nTime to Complete Sort: "+timediff1000m+" milliseconds or "+timediff1000s+" seconds.");
    } // end main method
    } // END project :)

    I never miss class....my instructor gave us the assignment of making a heap sort and he told us to use code off the internet as a resource because the only sorting we have done so far is bubble.....this was a research project, for my instructor to see if we can use the internet as an effective resource to put together a program and learn about a differnet type of sorting.....everyone in the class got a different type of sort (merge, quick, insertion, etc...). i have put the program together and customized it to my needs based on my knowledge.....the last thing i am having trouble with is my counting of comparisons and data movements. Can you please help me finish up my program.

  • Capturing various standard errors using openscript

    Hi , we have automized a scenario using openscript where in the steps are like starting from creating requistion --> Req approval --> PO creation and approval --> Receipt Creation --> Invoice Creation and then quick payment.
    when we playback the script it works fine with valid data inputs from databank. But we want to capture all the standard errors if any occurs in between when script playback. For eg : if Invoice batch name entered already exists in system it throws a warning like name already exists. At this step scripts fails but it capturing some error which end user wont understand. By anyway we can capture all the standard errors that can occur during functional testing. I mean we cannot write custom exception for each situation and may not what kind of errors we may face. So is there any way we can capture all the standard errors during functional testing using openscript/OTM. The platform we are using is Oracle Applicaitions ERP R12, open script 12.2

    Enter your codes in try and mention code like following in catch
    try{ }
    catch(Exception e ) {
    String pageindex = web.getFocusedWindow().getAttribute("index");
                if(web.element("/web:window[@index='"+pageindex+"']/web:document[@index='"+pageindex+"']/web:div[@text='Error']").exists()){
                fail(web.element("/web:window[@index='"+pageindex+"']/web:document[@index='"+pageindex+"']/web:div[@text='Error' ]").getParent().getAttribute("text"));
                else if(web.element("/web:window[@title='Oracle Applications R12']").exists()){
                    forms.captureScreenshot();
                        think(2.169);
                String statusBarMessage = "";
                if(! forms.getStatusBarMessage().equalsIgnoreCase("")){
                    statusBarMessage =""+forms.getStatusBarMessage().toString();
                if (forms.choiceBox("//forms:choiceBox").exists()) {
                    fail(" Unexpected choicebox found:- "+forms.choiceBox("//forms:choiceBox").getAlertMessage()+ (!statusBarMessage.trim().equals("") ? (".... \t Statusbar message: "+statusBarMessage) : ""));
                } else if (forms.alertDialog("//forms:alertDialog").exists()) {
                    fail(" Unexpected alertbox found:- "+forms.alertDialog("//forms:alertDialog").getAlertMessage()+ (!statusBarMessage.trim().equals("") ? (".... \t Statusbar message: "+statusBarMessage) : ""));
                } else {
                    fail(" Failed during script playback : " + e.getMessage()+(!statusBarMessage.trim().equals("") ? (".... \t Statusbar message: "+statusBarMessage) : ""));
            else {
                fail("   Failed during script playback : " + e.getMessage());
    Cheers,
    Deepu M
    [email protected]

  • Anyone Update Date/Timestamp using CachedRowSets, Java and Oracle 10g

    How to do this...
    a very small, direct snippet of code would be great..
    or direct me to a CURRENT document.
    Thanks

    What will I get back from Oracle with TO_CHAR?
    I am using a quoted string and supplying parameters.
    In other words, when I do the date comparison with a TO_DATE I already know that I am getting 12:00:00 AM back and the paramter I can manipulate.
    Example:
    TO_DATE(datefield) = formattedDateParameter
    The "TO_DATE(datefield)" is part of my prepared sql statement.
    I am not sure how much manipulation of the where clause I can do.
    My querystring would look like the following.
    sql = "SELECT " + REPORTTRANSDATE + REPORTRETURNCODE + " FROM " + REPORTTABLE + " WHERE " + REPORTD + "=?" + " AND " + "TO_DATE(" + REPORTTRANSDATE + ")" + ">=?" + " AND " + "TO_DATE(" + REPORTTRANSDATE + ")" + "<=?" + " ORDER BY " + REPORTTRANSDATE;
    Thanks.

  • Date Comparison Error

    I have a database column named lastname this has text data entered in form of: 05/15/2010  and so on.  ---long story on why text field and not date....
    My code is as follows:
    select b.lastname as sale_date, c.combined_legal as legal_address
      from anthem_prod_usr.opr_logi_documents      a
      ,    anthem_prod_usr.opr_parties             b
      ,    anthem_prod_usr.opr_legal_headers       c
      ,    anthem_prod_usr.image_references        f
      ,    prod_pa.valid_dates                     g
    where a.instrument_number = b.instrument_number
       and a.multi_seq = b.multi_seq
       and b.name_type = 'E'
       and b.lastname like ('__/__/____')
       and a.instrument_number = c.instrument_number
       and c.multi_seq = c.multi_seq
       and trunc(to_date(b.lastname,'mm/dd/yyyy')) between trunc(to_date('07/10/2010','mm/dd/yyyy')) and trunc(to_date('08/01/2010','mm/dd/yyyy'))
       and f.content_type_id = 'PUBLIC'
       and a.document_type = 'FORECLOSURE'
    Error I receive is:
    ORA-01843: not a valid month
    01843. 00000 -  "not a valid month"
    *Cause:   
    *Action:
    Using trunc function, I thought I was trimming time off to do only date comparison.  Not sure why this error occurs.

    Hi,
    This shows one of the many reasons why storing date information in VARCHAR2 columns is such a bad idea.
    TRUNC is irrelevant here.  The error occurs in TO_DATE.  You're doing TRUNC on the results of TO_DATE, so nothing you do with TRUNC will affect the error.
    You must have some bad data in the column.  If you can't actually clean up the table, then you have to detect the bad data before attempting TO_DATE.
    Remember, the optimizer decides which conditions in the WHERE clause will be done first.  There's no guarantee that
    and b.lastname like ('__/__/____')
    will be applied before TO_DATE.  Even if it is, the condition above is just testing that the string is the right length and has slashes in the right places.  It's checking that (for example) the month is between '01' and '12', or even if the month is numbers.  The string '//////FOO/' meets the condition above.
    See https://forums.oracle.com/message/4255051 for validating date information in SQL.
    If you need help, post a complete test case that people can run to re-create the problem and test their ideas.  Include CREATE TABLE and INSERT statements for any tables needed. Also post the results you want from that sample data given.
    Simplify the problem as much as possible.  Remove any tables or conditions or anything else that isn't related to the problem.
    See the forum FAQ https://forums.oracle.com/message/9362002#9362002

  • Oracle DB schema and data comparison tools that compare BLOBs

    I'm looking for schema and data comparison tool like DBDiff or DbTools, but it has to be able to compare BLOB and CLOB fields. I went thru few products available on the market but could not find any that does that.
    Can you please recommend tool that will help me with it.
    Thanks,
    E

    Hi.
    I use Comparenicus for Oracle from Orbium Software. It compares data and schema, CLOBs, BLOBs..
    It can also handle large tables which is very useful for some of my environments.
    Last (but not least) it has a unique feature for copying selective data from one DB to another. You can read about it this post:
    Efficient way to copy business data from Production DB to Test DB
    Enjoy..

  • Doubt regarding Date Comparison

    Hello,
    i am facing a problem in date comparison
    SELECT max(l.id)
    FROM irf_bill_details l
    WHERE to_char(l.agreement_id) = '508814'
    AND l.billing_client_id = 'BHPIF'
    AND extract(YEAR FROM l.bill_date) < extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    So when i am using this Query m getting the result ...BUT ...
    When i use the Below Query .... i am getting NULL ... So the problem surely is in when comparing with months ..?? how to get rid
    SELECT max(l.id)
    FROM irf_bill_details l
    WHERE to_char(l.agreement_id) = '508814'
    AND l.billing_client_id = 'BHPIF'
    AND extract(YEAR FROM l.bill_date) < extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    AND extract(MONTH FROM l.bill_date)||'-'||extract(YEAR FROM l.bill_date) < extract(MONTH FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))||'-'||extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    --------------------------------------------------------------------------------------

    Aijaz Mallick wrote:
    Hello,
    i am facing a problem in date comparison
    SELECT max(l.id)
    FROM irf_bill_details l
    WHERE to_char(l.agreement_id) = '508814'
    AND l.billing_client_id = 'BHPIF'
    AND extract(YEAR FROM l.bill_date) < extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    So when i am using this Query m getting the result ...BUT ...
    When i use the Below Query .... i am getting NULL ... So the problem surely is in when comparing with months ..?? how to get ridAre you saying that you're still getting one row of output, but the id on the row is NULL?
    SELECT max(l.id)
    FROM irf_bill_details l
    WHERE to_char(l.agreement_id) = '508814'
    AND l.billing_client_id = 'BHPIF'
    AND extract(YEAR FROM l.bill_date) < extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    AND extract(MONTH FROM l.bill_date)||'-'||extract(YEAR FROM l.bill_date) < extract(MONTH FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))||'-'||extract(YEAR FROM to_date('01-Jan-2010', 'dd-Mon-yyyy'))
    --------------------------------------------------------------------------------------Whenever you have a problem, post some sampel data (CREATE TABLE and INSERT statements) and the results you want from that data. Explain how you get those results from that data.
    As long as I don't know where you're starting from (sample data) or where you want to go (results) it's hard for me to give you good diorections.
    I suspect you want to be using TRUNC rather than EXTRACT, if not a plain DATE comparison.
    For example, if you have a string p_cutoff_date (such as '01-Jan-2010', but not necessaily the 1st of the month) and you want to see if l.bill_date is earlier than the beginning of the month that contains p_cutoff_date, then:
    WHERE   l.bill_date < TRUNC ( TO_DATE ( p_cutoff_date
                                          , 'dd-Mon-yyyy'
                       , 'MONTH'
                       )As you said in the subject line, you're trying to compare DATEs. So compare DATEs: don't convert them to NUMBERS (using EXTRACT) and then to strings (using ||); keep the DATEs as DATEs.

  • Date Comparison

    Hello All,
    UCCX 9
    Scenario: I would like the script to do a date comparison so that if Today's date is before xx/xx/xx or after xx/xx/xx I can direct it to different steps in the scripts.
    I have 3 string variables
    Current_Date  - Changes depending on the day
    Begin_Date    - 2/1/2014
    End_Date      - 2/10/2014
    Step 1
    I have an IF statement
    If Current_Date < Begin_Date
    -True Goes to Time_of_Day_check
    -False Goes to End_Date_check
    Step 2
    If the above outcome is False it checks the End_Date
    IF Current_Date >End_Date
    -True   Goes to Time_of_Day_check
    -False Goes to Alternative Time_Of_Day_check
    The issues I'm having is with Step 2
    When the End_Date is less than 2/6/2014 it works fine.
    For example if End_date is 2/3/2014 it goes to True, which is correct.
    However,
    When the date is 2/10/2014, it still goes to True.., which is incorrect
    When I change the End_Date to 3/1/2014, then it starts going to False
    Am I unable to compare dates like this?  Is there a better way to compare dates?
    Thank you,

    I'm not sure I understand what you're doing, in order to give you an answer, however, I can tell you that Date objects, not Strings, are what you're going to want to work with when performing comparisons.
    Date object values are also just a Long value for the number of milliseconds since Jan 1, 1970 at 00:00:00.000 AM.
    It's key that you understand that it's the number of millisecond that it's holding.  Which explains why this is true today:  D[now] > D[2/6/2014].  Today being 2/6/2014 of course.  That because D[now] holds the current time the step is executed, whereas D[2/6/2014] is left to hold the time 00:00:00.000.  And no matter what time it is when the script executes, there's only a 1/86400000th of the day's time that they will be equal, which will make the conditional false.  Therefore, you would enter D[now] >= D[2/6/2014], which would be true for all 86400000 milliseconds of the day.  I, like you, would have expected that original condition to be false, because today is not after 2/6/2014; today is 2/6/2014.
    The easiest way, in my opinion, to compare two dates, without consideration for their time values, is to reset the time values of both objects to the same value.
    E.g.,
    Set today = new Date()Set today = new Date(today.getYear(), today.getMonth(), today.getDate())Set start_date = new Date(2014 - 1900, 2, 6)Set end_date = new Date(2014 - 1900, 2, 14)If (today >= start_date && today <= end_date)     True          Goto Alt ToD     False          Goto ToD
    Anthony Holloway
    Please use the star ratings to help drive great content to the top of searches.

Maybe you are looking for