Comparing numbers in two arrays

OK I am making a lottery program in Java. The idea is a user enters 4 numbers, they are saved to disk. A user then starts the draw which creates 4 random numbers and compares them with the numbers a user has chosen and sees if there are any matches. Here's what I have in my Do_Draw method
public static void Do_Draw() {
        String input;
        int Numbers[] = new int[5];
        int[] numbers = new int[4]; //array declared
        int numBalls = 4; //integer
        int[] balls = new int[numBalls];
        for (int i = 0; i < balls.length; i++) {
            balls[i] = i + 1;
        for (int i = 0; i < numbers.length; i++) {
            int drawnBall = (int)(Math.random() * numBalls);
            numbers[i] = balls[drawnBall];
            balls[drawnBall] = balls[numBalls - 1];
            numBalls--;
            System.out.print(numbers[i] + " "); //print out numbers for user to see
            try {
                FileOutputStream assfile = new FileOutputStream("a:/draw.txt", true); //true allows the file to be appended
                PrintStream myOutput = new PrintStream(assfile);
                myOutput.println(numbers);
} //end of try
catch (IOException e) {
System.out.println("error writing to file, please check your disk");
System.exit(0);
} //end of error message
JOptionPane.showMessageDialog(null, "The draw has taken place, Thank You");
int matches = 0;
for (int i = 0; i < numbers.length; i++) {
for (int j = 0; j < Numbers.length; j++) {
if (numbers[i] == Numbers[j])
matches++;
System.out.print("You have matched" + matches);
I get a repeated message at the end, I know this but it does tell me if I have any matches. It always tells me I have no matches though. It compiles fine and looks ok but I am not sure why it is not matches. Cheers for all your help

Hmm...you are trying to match numbers in number[] to Number[], but you do not assign any numbers to Number. I ran your program an Numbers is just full of zeros, so all you need is to enter the numbers the user wants into Number array and you should be fine...if this doesnt work, feel free to write me again.

Similar Messages

  • Compare two arrays

    I have two arrays such as these
    Array 1                          Array 2
    a      1
    a      5                                 a
    b      2                                 b
    c      3                                 f
    d      4                                 g
    e      5                                 h
    f       6
    g      7
    g      10
    h      8
    h      9/
    with what i have now i can create an array that lists the matching elements
    Results:
    a          1
    b          2
    f           6
    g          7
    h          8
    However, it does not record both sets of a,g, and h, only the first instance. Anyone know how to fix this problem?
    Any help is appreciated
    Solved!
    Go to Solution.
    Attachments:
    Compare Arrays.vi ‏14 KB

    rmarks12 wrote:
    im pretty new to labview.
    That's okay we were all new at some point.  If you have an question about a function in particular you can open the context help (CTRL + H) and over over a function to learn more.  Also here is some free training if you are interested.
    NI Learning Center
    NI Getting Started
    -Hardware Basics
    -LabVEW Basics
    -DAQ Application Tutorials
    3 Hour LabVIEW Introduction
    6 Hour LabVIEW Introduction
    Self Paced training for students
    Self Paced training beginner to advanced, SSP Required
    LabVIEW Wiki on Training
    With questions on anything else, feel free to do what you are already doing, post here on the forums.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Compare Two Array

    Hi,
    can you plz help me.
    How i can compare two array. following my code..
    var my_array:Array=Array(5,10,15,20,25,30)
    var new_array:Array=Array(7,8,9,10,11,12,13)
    for(var i:Number=0;i<my_array.length;i++){
        if(my_array[i]==new_array[i]){
            trace(my_array[i])
    Thanks in Advance,
    JaxNa

    hey dear can you tell me one thing..
    when my_array length is 3
    and new_array length is 5
    that time how i can compare two array actually i have this problem..
    var my_array:Array = Array(5, 10, 15, 20);
    var new_array:Array = Array(7, 8, 9, 10, 11, 12);
    for (var i:Number = 0; i<my_array.length; i++) {
         if (my_array[i] == new_array[i]) {
            trace("'My Array' "+i+"("+my_array[i]+") 'new_array' "+i+"("+new_array[i]+") = Matching");
         } else {
            trace("'My Array' "+i+"("+my_array[i]+") 'new_array' "+i+"("+new_array[i]+") = Not Matching");
    Thanks

  • Two array objects compareTo:

    Have two arrays: ttt and ppp. I have to have a method to compare them.
    public int compareTo(object ob)
    both of the arrays are int type and both have super long numbers in them.
    Thanks

    Actually, the reflection api is pretty fast since
    JDK1.4.0...No. Reflection could not be fast. In J2SDK1.4 it seems to be faster then in previous releases. But improvments do not include array operations. So here are some results of simple benchmark:
    bash-2.05a$ /usr/java/jdk1.3.1_04/bin/java TestArray
    Result for reflect copiing (3 elements, 1000000 times): 4915ms
    Result for system copiing (3 elements, 1000000 times): 460ms
    Result for pure java copiing (3 elements, 1000000 times): 137ms
    bash-2.05a$
    bash-2.05a$ /usr/java/j2sdk1.4.0_01/bin/java TestArray
    Result for reflect copiing (3 elements, 1000000 times): 6082ms
    Result for system copiing (3 elements, 1000000 times): 491ms
    Result for pure java copiing (3 elements, 1000000 times): 115ms
    bash-2.05a$
    bash-2.05a$ /usr/java/j2sdk1.4.1/bin/java TestArray
    Result for reflect copiing (3 elements, 1000000 times): 5738ms
    Result for system copiing (3 elements, 1000000 times): 497ms
    Result for pure java copiing (3 elements, 1000000 times): 157ms
    bash-2.05a$
    As you can see, in new Java reflect operations on arrays are even slower then in jdk1.3.1. System copiing is good alternative for pure java (element by element) copiing, espetially for big arrays. And here is the code of this benchmark, test it on your PC also:
    import java.lang.reflect.*;
    public class TestArray {
        static void doNothing(){}
        static int field;
        public static void main(String[] args) throws Exception {
            final int COUNT = 3, TIMES = 1000*1000;
            final String[] arr1 = new String[COUNT];
            final String[] arr2 = new String[COUNT];
                long time = -System.currentTimeMillis();
                for(int i=TIMES; i-->0;)
                    copyReflect(arr1, arr2, COUNT);
                time += System.currentTimeMillis();
                System.out.println("Result for reflect copiing ("+COUNT+" elements, "+TIMES+" times): "+time+"ms");
                long time = -System.currentTimeMillis();
                for(int i=TIMES; i-->0;)
                    copySystem(arr1, arr2, COUNT);
                time += System.currentTimeMillis();
                System.out.println("Result for system copiing ("+COUNT+" elements, "+TIMES+" times): "+time+"ms");
                long time = -System.currentTimeMillis();
                for(int i=TIMES; i-->0;)
                    copyPureJava(arr1, arr2, COUNT);
                time += System.currentTimeMillis();
                System.out.println("Result for pure java copiing ("+COUNT+" elements, "+TIMES+" times): "+time+"ms");
        private static void copyReflect(Object src, Object dst, int count) {
            for(int i=count; i-->0; ) Array.set(dst, i, Array.get(src, i));
        private static void copySystem(Object src, Object dst, int count) {
            System.arraycopy(src, 0, dst, 0, count);
        private static void copyPureJava(String[] src, String[] dst, int count) {
            for(int i=count; i-->0; ) dst[i] = src;

  • Can;t find what is wrong. Trying to add elements in two arrays

    Hello everyone
    I'm trying to take as input two numbers, convert them to arrays and add all the element of the array one by one. I want the result to be the sum of every element of the array. Let's say array1={1,2,3,4} and array2={2,6,4,3} I want the final result to be 3877.
    If the sum of one element of the array is greater than nine, then I would put zero and add 1 to the element on the left.
    Here is the code:
    import javax.swing.JOptionPane;
    public class Main {
        public static void main(String[] args) {
            String numberOne = JOptionPane.showInputDialog
                                    ("Enter the first number: ");
         String numberTwo = JOptionPane.showInputDialog
                                    ("Enter the second number: ");
            //compare string length and make them equal length
            int[]n1 = toArray(numberOne); // my first array
         int[]n2 = toArray(numberTwo); // my second array
         //call the method that ads both strings
         int[]finalArray = arrSum(n1,n2);
           JOptionPane.showMessageDialog(null, "The sum of the two numbers is: "
                   + finalArray);
        }//end of main
        //method to create an array from a string
        public static int[] toArray(String str)
                int[]arr = new int[str.length()];
                arr[0]=0;
                for (int i=1; i<str.length(); i++)
              arr= Character.digit(str.charAt(i),10);
    return arr;
    }//end of toArray
    //method to add arrays by elements
    public static int[]arrSum (int[]arr1, int[]arr2){
    for (int i = arr1.length-1; i >=1; i--)
    int sum = arr1[i] + arr2[i];
    if (sum > 9)
              { sum -= 10;
              arr1[i-1]++;
    return arr1;
    }//end of arrSum method
    }Edited by: designbc01 on Feb 16, 2010 1:15 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    The best advice I can give you is to break your problem up into smaller pieces. First, focus on a method that converts an input String into an array. When you have that working perfectly, then focus on creating a method that "adds" two arrays with the logic you described. When you have that working perfectly, then combine the two different pieces.
    Why does your for loop in toArray( ) start with 1? The first index of a String, array, or pretty much anything else, is zero.

  • About combing two array into one

    Hi all,
      I post a questiona bout converting an array of integer into char (byte) array and I got a solution already http://forums.ni.com/t5/LabVIEW/how-to-display-char-code-properly/m-p/2596087#M780368
    However, I enouther another problem while dealing with an array of  U16 type. I would like to extract the high and low byte from numbers (U16) stored in array. I extract the high and low byte for each U16 number and convert them as char, concatenate them to a string. Repeat this process for each element in the array so to get a big string with each element is a char for high and low byte. My code is enclosed as follows
    It works fine but I am concerning the speed. Is that any other way to do it fast and don't use loop (in real case, I will deal with pretty big array many times, efficiency is a problem). Note that the high and low bytes array extracted from the original array with the module Split number.vi, but how can I combine these two array in one code with data arranged as high-low-high-low ... ? Thanks.
    Solved!
    Go to Solution.

    PKIM wrote:
    However, I enouther another problem while dealing with an array of  U16 type. I would like to extract the high and low byte from numbers (U16) stored in array. I extract the high and low byte for each U16 number and convert them as char, concatenate them to a string. Repeat this process for each element in the array so to get a big string with each element is a char for high and low byte. My code is enclosed as follows
    It works fine but I am concerning the speed. Is that any other way to do it fast and don't use loop (in real case, I will deal with pretty big array many times, efficiency is a problem). Note that the high and low bytes array extracted from the original array with the module Split number.vi, but how can I combine these two array in one code with data arranged as high-low-high-low ... ? Thanks.
    You need to be more clear.
    Looking at the code, you are dealing with I16, not U16. Also your index array primitives could be replaced by autoindexing. Your use of the feedback node only makes sense if you want to append strings forever with stale data, thus growing data structures without limits. If you only want to convert the current data, remove the feedback mode and use a "concatenate strings" with a single input. A for loop is one of the most efficient data structures and using it is not a problem. One way or another the code needs top oerate on all data.
    All that said, I agree with Tim that most likely all you need to do is insert a typecast after the "to I16" and eliminate all other code.
    LabVIEW Champion . Do more with less code and in less time .

  • I got two arrays how to search and match them???????

    Hi experts plz help me out~
    i got two arrays one contains students id
    and the other one contains students id and marks
    i have to compare these two, match id, and store value next to that students.
    but how to match these two
    one file:
    213 John
    356 Chris
    421 Paul
    the other file
    356 55
    421 67
    213 69
    and so on
    i have to search both and matching IDs and store marks for them
    i ve done string tokenizing part only.................
    help me~~~~~~~~~~~~~

    You can read each file into a Map and have the student ID as a key, then you can iterate over the student map keyset and find marks for each key.
    Mike

  • How do I add more than 5 phone numbers and two emails to a contact in Thunderbird address book?

    I have just started using TB 31.4 and am planning to move contacts (about 1400 from Outlook) into the TB Address Book. Many of my contacts have multiple email addresses, more than five telephone numbers, and more than two street addresses.
    In doing a small import test I noticed that TB only has space for five telephone numbers and two email addresses, two street addresses. Is there a way to add more so that I do not lose this data on the import?
    Is there a way to rename telephone number fields (as almost no one has a pager anymore)?
    Can you create a third street address location?
    I understand the use of custom fields but that seems less than satisfactory method.

    There is an addon called 'MorefunctionsForAddressBook'. See link below.
    * https://freeshell.de/~kaosmos/morecols-en.html
    scroll down to the bottom to see the download link, which looks like this;
    '''Download MoreFunctionsForAddressBook - 0.7.1 version (TB 3.0 or higher)'''
    Download .xpi file to desktop or downloads file.
    '''How to install addon:'''
    In Thunderbird
    * 'Tools' > 'Add-ons' OR 'Menu Icon' > 'Add-ons'
    * Click on the gear wheel icon and select 'Install addon from file'
    * locate the addon .xpi file you downloaded and click on 'Open'.
    * Once installed it will appear in the list of Addon Extensions.
    * You will need to restart Thunderbird.
    This addon offers more fields etc and much more eg; importing etc.

  • How can I compare more than two VIs at a same time in labview 2009

    How can I compare more than two VIs at the same time. I am an Lab Engineer I have to check assignments submitted by students and I want to know how many of them are copied from each other. Labview compare VI can only compare two VI at a time while I want to check about 30 VIs at same time.
    Regards,

    I'm not aware of a tool to compare multiple VIs.  If you don't find anything, consider posting this to the LabVIEW Idea Exchange to expose this idea directly to NI R&D.
    Thanks!
    - Greg J

  • A lot of time to multiply two arrays

    Hello!
    I want to multiply two arrays. The size of the two arrays is 1568x1568. I use to do it a AxB.vi block....but it spends a huge time, almost 17 seconds, when a operation like this have to be done it less than in a second.
    I 've attached an example of the multiplication of two arrays with this size, you have to wait 16 seconds to obatin the result.
    Someone know how i can do this multiplication as far as possible?I have to use another block.....for example....formula node and make iterations (or in this way you spend the same time?)
    Thank you very much
    Larson

    Nomis wrote:
    On my system (P4, 2.6GHz, 1GB Ram Win2K), the example runs in 19 seconds in LV7.0 but in 7.1 it runs in 300mS!
    No idea why - perhaps the AxB function was rewritten for 7.1
    Yes the matrix operations got a big makeover in LabVIEW 7.1 and are MUCH faster as demonstrated here.
    On my 1.6GHz PentiumM laptop, the difference is not that big, but still about 10x.
    LabVIEW 7.0: 3700ms
    LabVIEW 7.1: 360ms
    Time to upgrade!
    LabVIEW Champion . Do more with less code and in less time .

  • User defined func: Unavble to merge two arrays in result list

    Hi
    I am trying to merge two arrays on the basis of "FEE" element in the input file;
    Actually there is an Attribute Name and Value pair array coming in the input file which has 5 pairs already(Notification + 100 , oversize + 8 etc.) see example below;
    <m0:Fees>ZB9</m0:Fees>
    <m:Attribute>
      <m0:Attributename>NOTIFICATION</m0:Attributename>
      <m0:Attributevalue>100</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>OVERSIZE</m0:Attributename>
      <m0:Attributevalue>8</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>OVERWEIGHT</m0:Attributename>
      <m0:Attributevalue>108</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>SIGNATURE</m0:Attributename>
      <m0:Attributevalue>294</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>RTS</m0:Attributename>
      <m0:Attributevalue>8</m0:Attributevalue>
      </m:Attribute>
    The condition is:
    CASE 1. If the FEE doesn't exist in the file then only the Atrribute Name and Value in added to the Array
    CASE 2 If FEE exist then add all the Atrribute Name and Value pairs as well as in the last index of Array add String "Fee" in Attributename and String "ZB9" in  Attributevalue.
    CASE 1 is working fine.
    but in CASE 2 even if i m taking an output array of length Attributename +1 and Attributevalue +1 and trying to add "Fee" and "ZB9" respectively, it never happens.
    Please have a look at the code below;
       //write your code here
    public void ud_Attributename(String[] Fees,String[] Attributename,ResultList result,Container container){
              String attribute_copy[]=new String[Attributename.length+1];
              String attribute_name[]=new String[Attributename.length];
              String array_copy1[]=new String[Attributename.length+1];
              //int len =Attributename.length;
              if(Fees[0]!=null)
                   if(Fees[0].equals("ZB0"))
                   Fees[0]="01";
                   else if(Fees[0].equals("ZB5"))
                   Fees[0]="02";
                   else if(Fees[0].equals("ZB6"))
                   Fees[0]="03";
                   else if(Fees[0].equals("ZB9"))
                   Fees[0]="04";
              try{
                   if((Fees[0]=="01")||(Fees[0]=="02")||(Fees[0]=="03")||(Fees[0]=="04"))
                        for(int x=0;x<=Attributename.length;x++)
                             if(x==Attributename.length)
                             array_copy1[x]="Fee";
                             else{
                             array_copy1[x]=Attributename[x];
                             result.addValue(array_copy1[x]);
                   else
                        for(int i=0;i<=len;i++)
                             attribute_name<i>=Attributename[i+1];
                             result.addValue(attribute_name<i>);
              }catch(Exception e)
              {e.printStackTrace();}
    Same way i've used for Attributevalue.
    But the result is
    <ATTRIBUTEPAIR>
    <PAIR>
    <NAME>NOTIFICATION</NAME>
    <VALUE>04</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERSIZE</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERWEIGHT</NAME>
    <VALUE>108</VALUE>
    </PAIR>
    <PAIR>
    <NAME>SIGNATURE</NAME>
    <VALUE>294</VALUE>
    </PAIR>
    <PAIR>
    <NAME>RTS</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    </ATTRIBUTEPAIR>
    Please suggest where i am wrong. ur help is very much appreciated.
    Thnks in advance

    this is i am doing now
       //write your code here
              String attribute_copy[]=new String[Attributename.length+1];
              String attribute_name[]=new String[Attributename.length];
              String attribute_name1[]={"Fee"};
              //String[] Attributename.copyTo(attribute_name1,0);
              //String[] attribute_name1 = (String[]) Attributename.Clone();
              //String fees;
              String array_copy1[]=new String[Attributename.length];
              int len =Attributename.length;
              for(int y=0;y<len;y++){
              array_copy1[y]=Attributename[y];
              if(Fees[0]!=null)
                   if(Fees[0].equals("ZB0"))
                   Fees[0]="01";
                   else if(Fees[0].equals("ZB5"))
                   Fees[0]="02";
                   else if(Fees[0].equals("ZB6"))
                   Fees[0]="03";
                   else if(Fees[0].equals("ZB9"))
                   Fees[0]="04";
                   else if(Fees[0].equals("ZA1"))
                   Fees[0]="05";
                   else if(Fees[0].equals("ZA2"))
                   Fees[0]="06";
              try{
                   if((Fees[0]=="01")||(Fees[0]=="02")||(Fees[0]=="03")||(Fees[0]=="04")||(Fees[0]=="05")||(Fees[0]=="06"))
                        int j=0;
                        for(int a=0;a<=len;a++)
                             if(j==0&&attribute_copy[j]==null)                                   
                                  attribute_copy[j]="Fee";
                             else
                                  //int b=-1;
                                  for(int i=0;i<=len;i++)
                                       if(i==j)
                                       //i=i-1;
                                       attribute_copy[j]=array_copy1[i-1];
                                       break;
                                       else{
                                       continue;}
                        result.addValue(attribute_copy[j]);
                        j+=1;
                   else
                        for(int i=0;i<=len;i++)
                             attribute_name<i>=Attributename[i+1];
                             result.addValue(attribute_name<i>);
              }catch(Exception e)
              {e.printStackTrace();}
    and the result in queue is
    SUPPRESS
    [FEE]
    [NOTIFICATION]
    [NOTIFICATION]
    [OVERSIZE]
    [OVERSIZE]
    [OVERWEIGHT]
    [OVERWEIGHT]
    [SIGNATURE]
    [SIGNATURE]
    [RTS]
    [RTS]
    but in the output i m getting
    <ATTRIBUTEPAIR>
    <REF_HANDLE>0001</REF_HANDLE>
    <PAIR>
    <NAME>Fee</NAME>
    <VALUE>04</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERSIZE</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERWEIGHT</NAME>
    <VALUE>108</VALUE>
    </PAIR>
    <PAIR>
    <NAME>SIGNATURE</NAME>
    <VALUE>294</VALUE>
    </PAIR>
    <PAIR>
    <NAME>RTS</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    </ATTRIBUTEPAIR>
    Notification is missing.

  • Read from .txt file and output the content as two arrays

    I am using the contoured move to control the x-y stage. The trajectory datas for x and y axis are generated using my interpolation program and it is stored in a .txt file as two columns. What I want to do is read .txt file and output the content of this file as two arrays. Is there anyone has any ideas? Thanks, the .txt file is attached.
    Attachments:
    R.75.txt ‏172 KB

    Hi Awen,
    This is quite easy to do, you can merely use the "read from spreadsheet file" function to get a 2D array (2 columns and n rows) and then use the index array function to get whatever row/colums you want..
    Hope the attached VI helps you
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    read sprdsheet file.vi ‏27 KB

  • How to compare data between two tables?

    Hi,
    My team is trying to develop a SAP data migration tool (DMT) using ABAP.
    One of the functionalities in the DMT is to validate the data in the staging area against the loaded SAP data.
    The tables in the stagin area are customer tables (i.e. user-defined tables starting with Y, Z).
    How do I compare the data in the staging area against data that are loaded into SAP tables? Are there some built-in SAP functions to do this? Or, are there some better ways of doing this (e.g. instead of comparing against data in the SAP tables, we compare with some INTERNAL tables)?
    Any help would be greatly appreciated, thanks!

    Hi Kian,
    Use <b>SCMP</b> transaction to compare data between two tables and you can not use this for comparing internal tables.
    Thanks,
    Vinay

  • I have two arrays of points, when i plot them there´s an intersection point, but this point doesn´t belong to any arrays...

    I have two arrays of points, when i plot them there´s an intersection point, but this point doesn´t belong to any arrays. I need to find the both value of this point, X and Y. I attached my problem in a very simple example. Thanks.
    Attachments:
    arrays_plot.vi ‏25 KB

    Although this doesn't directly answer your question , I've attached a VI that will hopefully give you a start and point you in the right direction. It generates a Boolean array that indicates between which indecies an intersection has taken place. Then, all you need to do is use triganometry to work out exactly what the intersection point is.
    Copyright © 2004-2015 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 2.5 License.
    Attachments:
    2x1D_Array_Intersections.vi ‏36 KB

  • How to compare dates between two items

    Hello all,
    I am trying to compare dates in two items.
    The first item is a computation P45_PAGE_LOADED_TIME
    select sysdate from dual;
    This essentially keeps track of when the user opened the form. They are accessing data that may become obsolete while they are in the form.
    So we have a dynamic action that finds the last_update date from a table. This field is of type date. It is placed in a text field called P45_STATUS.
    We then have a notification which we want to fire when P45_PAGE_LOADED_TIME is before P45_STATUS. We tried the following condition
    declare
    least_date date;
    begin
    SELECT LEAST(TO_DATE(:P45_STATUS),TO_DATE(:P45_PAGE_LOADED_TIME)) into least_date
    from dual;
    if least_date = to_date(:P45_STATUS) then
    return false;
    else
    return true;
    end if;
    end;
    Any guidance would be most appreciated.
    Thanks

    Maybe your better off putting your anonymous block into a plsql function.
    A function that you can test. If it works in plsql then you must call it in APEX.
    I kinda get a headache when I see that least, to_date, to_date query (although I've seen worse :p)
    Make it like:
    create or replace function fun_least_date(in_status in varchar2,
                                                               in_page_loaded_time varchar2) return boolean
    is
      l_status date;
      l_page_loaded_time date;
      least_date date;
      l_return boolean;
    begin
      l_status := to_date(in_status, 'FORMAT MASK!!!');
      l_page_loaded_time := to_date(in_page_loaded_time, 'FORMAT MASK!!!!');
      least_date := least(l_status, l_page_loaded_time);
      if least_date = l_status then
        l_return := false;
      else
        l_return := true;
      end if;
      return l_return
    end fun_least_date;If your sure that your function is correct then use it as a condition for your dynamic action.
    Regards
    Nico
    ps: I haven't tested that function. Be aware that you most correctly enter the format mask you use in APEX. Also before APEX may know about these variables you should set a dynamic action on your items to always submit their value to the server when they change!!!

Maybe you are looking for

  • Help, Java newbie a little over my head with LDAP

    I'm actually a network admin but I've been dabling in Java for a little while now. I am trying to write an app that will allow me to insert and remove attributes to entries in Active Directory. I have found some sample code which I have altered to ma

  • Upgrading Hard Drive from 200GB (7,200rpm) to 320GB (7,200rpm)

    I very much would like to upgrade the hard drive in my MacBook Pro 17" from the supplied 200GB 7,200rpm to the newer larger capacity of the 320GB 7,200rpm being recently made available. I purchased my MacBook Pro 17" as a custom spec in the second ha

  • Mac Mini + PC

    I am thinking about purchasing a Mac Mini, but I would still like to be able to use my PC. I want to use my monitor, keyboard, mouse, and possibly audio(not a big deal). With the mac mini and my pc, but still keep a DVI connection between my PC and m

  • UNIX command via Java?

    Hello all, one of the useful commands in unix is sed I would like to use the functionality of sed in Java. Is there any free java api where I can send a command like sed -n pos1,pos2p filenamethanks Aykut

  • Screen size and Premiere Pro

    So, I use to use Premiere Pro when I worked mostly from a desk top. I switch to PE when I got a laptop. Well, I am thinking of getting PPro again. My laptop has enough RAM and processor speed and all that - BUT it has a 13.5 inch screen. (I travel al