Searching for data

I have a program that reads from a notepad file into an array, the user is then to enter a number into a message box and the program is supposed to find all entries like that find the average number and then show the highest number as well. how do i go about doing this???? i am new to java so dont get too technical with the answers please cos i wont understand it. Thanks

You can read the file line by line using the FileReader class and then search each line for the numbers. Then add these numbers to an ArrayList and use the Collections.max() method to get the highest number. First, try this and we can get back to determining the average later.
If you don't know about I/O and Collections, you should read the tutorial:
http://java.sun.com/docs/books/tutorial/essential/io/index.html
http://java.sun.com/docs/books/tutorial/collections/index.html

Similar Messages

  • Clues about query's - Search for date type at INBOX

    Hello Everyone,
    At IC Webclient, does anyone experiment to add a new search date type at INBOX, at "search for date" search parameter?
    I added a new date type at Date Management, ZDATA_PR.
    When I try to assemble the query parts, I use something like this:
    CL CL_CRM_QUERYAUI_RUN_BTIL
    METH READ_BUSINESS_TRANSACTIONS
    CALL METHOD cl_crm_report_qupart=>get_qupart_by_token
        EXPORTING
          iv_token     = 'DAT'
          iv_date_type = 'ZDATA_PAR'
          iv_from      = ls_query_aui-from
          iv_to        = ls_query_aui-to
        IMPORTING
          ev_qupart    = ls_qupart_range-querypart.
      APPEND ls_qupart_and   TO lt_query.
      APPEND ls_qupart_range TO lt_query.
    However, I'm rewarded with an error message telling me that I have problems with the query.
    Does anyone can give me clues how to perform this action? I'm clueless and there's not almost no information about this...
    Thanks and Kind Regards
    Bruno Garcia

    Just to solve a mistake at example code:
    CALL METHOD cl_crm_report_qupart=>get_qupart_by_token
    EXPORTING
    iv_token = 'DAT'
    iv_date_type = 'ZDATA_PR'
    iv_from = ls_query_aui-from
    iv_to = ls_query_aui-to
    IMPORTING
    ev_qupart = ls_qupart_range-querypart.
    APPEND ls_qupart_and TO lt_query.
    APPEND ls_qupart_range TO lt_query.
    does anyone has a suggestion or a clue to give?
    Thanks
    Bruno

  • Search for data in server based database.

    I have a web page (http://gosolivitahomes.com) where I can enter a search for data in my server based database.  If I enter a value less than $100,000 in Min Price I get no response.  For values >= $100,000 I get the correct response. Why?  Please help.

    Yesterday I got no properties under $100,000.
    To day I tried again and the first time I got 2 results, but when I went back and repeated the same thing, I got no result.
    Then, like John Waller suggested, I cleared my cache and the 2 result were back.
    Perhaps your problem is a template or other cms cache issue. I don't know very much about it, but when I had a login problem I had to disable user cache i the cms (Joomla).
    I hope you will solve the problem

  • Searching for Data in the Report for a non-selected column in display.

    Hello,
    I have an interactive report as given below:
    select user, dept_name, sal, description, title from hr;
    Now, in the report display options I remove the title and description from the display as you know title and description are 2000 characters each.
    If I show then it takes the whole page to display one record and with this option I can search any text in the Title or Description columns.
    Now, I have hidden these two columns and when I search I do not see any records.
    Can any one tell me how to achieve this behaviour.
    What I am looking is, I do not show the column 'TITLE' or 'DESCRIPTION' and user show be able to search for any important data inside these columns.
    Please let me know how can we do this.
    Please point me to an already published article or solution or any help on this type.
    Appreciate your help on this.
    thanks
    Edited by: user648778 on Sep 18, 2008 6:13 PM

    As far as I can see this will not work. You could use a trick and make a query like this:
    SELECT USER, dept_name, sal,
              apex_item.hidden (10, mgrdescription || title)
           || '<img src="#IMAGE_PREFIX#some_nice_icon.gif">' title_description
      FROM hrThis would not display the title and description but an image and it would give you a possibility to filter on those.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Search for data within a database table

    Hi everyone :)
    I'm trying to make it so that the user can search for a record by id #. So, i made an input dialogue thing so the user can enter a record #. Basically, i want the data to appear in their textboxes based on the record # inputted by the user. My attempt is shown below, and when I run it, I get this:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    Here's my code:
    public JButton getSearch()
              if (search==null)
                   search = new JButton("Search Database");
                   search.addActionListener
                        new ActionListener()
                             public void actionPerformed(ActionEvent ae)
                                  try
                                       String str_rec =
                                            JOptionPane.showInputDialog(
                                                 getFrame(),"Enter Record No");
                                       int recNo = 0;
                                       try
                                            recNo =
                                                 Integer.parseInt(str_rec);
                                       catch (NumberFormatException nfe)
                                            return;
                                       String select = "SELECT studId,studFirstName,studLastName " +
                                       "FROM Students " +
                                       "WHERE studId = '" + recNo + "' ";
                                       Statement statement = getConnector().getConnection().createStatement();
                                       ResultSet result = statement.executeQuery(select);
                                       System.out.println(recNo);
                                       getView().getId().setText(str_rec);
                                       getView().getFirstName().setText(result.getString("studFirstName"));
                                       getView().getLastName().setText(result.getString("studLastName"));
                                  catch (Exception e)
                                       e.printStackTrace();
              return search;
         }I hope I explained everything properly. If you could please help me, I'd very much appreciate it.
    Thanks in advance! :)
    - spidey

    "WHERE studId = '" + recNo + "' ";Why are you putting quote marks around a number? What type of database column is studId? Probably a numeric type (not character), right? Quotes go around string/character stuff, not numeric stuff.

  • How to search for data on the web and return to jsp

    I need to collect data from a web site and return that data to my jsp file. The page should consist of a web page in which the user search for available flights then I conect to easyjet automatically fill in the form and return the result from easyjet.com to my jsp file..Do anyone know how can I do this?? I need to use java for this and not cgi..I found also some JavaScripts that can perform the same thing..Thanks...

    Hi,
    are you able to change dynamically the  operation.url = "assets/data/shopping.xml";?
    i need to do that based on the users input.
    Thanks in advance,

  • How to search for data in active directory

    if i have an administrator priviledge, how can i search for user's data if i know his username from active directory.

    What form do you have the user's name in ?
    ANTIPODES\alberteString searchFilter = "(&(objectClass=user)(samAccountName=alberte))";[email protected] searchFilter = "(&(objectClass=user)(userPrincipalName=[email protected]))";Albert EinsteinString searchFilter = (&(objectClass=user)(givenName=Albert)(sn=Einstein))";or using Ambiguous Name Resolution (anr)String searchFilter = "(&(objectClass=user)(anr=Albert Einstein))";or it's even clever enough to useString searchFilter = "(&(objectClass=user)(anr=Einstein Albert))";

  • Database-Searching for dates

    If I enter in an exact date (such as 7/9/06) in my database's Find layout that matches an existing record then AppleWorks finds the record. But I want to find all records that contain ANY date in the date field. If I type in a character in the date field that is bound to be present, such as 0 (zero), AppleWorks doesn't find anything. I have to enter an exact date. Is there a way to search for all records in which the date field is not empty?

    From the Organize menu, choose "Show All Records".
    Again from the Organize menu, choose "Match". In the dialog select the "All" dropdown and choose "Logical". Click on the "ISBLANK" entry, then from the left column click on the date field you're trying to search. Your search field should look like: ISBLANK('date')
    (... the parentheses will contain the actual name of the field you chose)
    Click "OK" and the matched records will have been selected.
    Again from the Organize menu, choose "Hide Unselected"

  • Search for Data in all schema

    I have user_x
    I know in one of its tables.Column there is a value 99
    I need to write a script to search all tables under the schema form the value of 99 ?

    PLease have a look at the script in :
    http://it.toolbox.com/blogs/david/search-for-a-given-string-in-all-fields-of-an-entire-schema-24074
    It might help you meet your requirement.

  • Problem searching for data in database

    hello, im facing a problem here. Actually i have 2 files,jsp and a javabean file. The jsp files basically contains a few radio buttons and a text field. Now what im planning to do here is if user enter a value in the text field and selects the appropriate radio button, it will basically perform a search. The problem here is its not displaying any results although that particular data is in the database.
    Actually the real problem is its not passing the data to the javabean. This is how the statement looks like in the JSP file
    String field = request.getParameter("searchfield");
    ResultSet rs = ad.searchFirstName(field);
    searchfield = name of the text field
    ad = name of the usebean id
    searchFirstName = name of the method in the javabean that will perform this search function
    Now the javabean file
    public ResultSet searchFirstName(String field)
    This is how the method declaration looks like
    the sql statement is stated as below
    SELECT * from PersonalInfo where FirstName LIKE '%field%' order by FirstName;
    Everything ok(no errors in code) but i realise that its not displaying any data. i think its not passing the value from the jsp text field to the javabean. This is because if i replace the "field" with a data in the database, it displays the data. But if i dont, it just dont display any data. How can i pass a variable that user enter in the jsp text field file to a javabean file for processing..
    Pleaseee help..i have been working on this for quite some time. Thanks in advance..

    You might need something like this:
    String sql = "SELECT * from PersonalInfo where FirstName LIKE '%" + field + "%' order by FirstName";
    Even better would be to use a prepared Statement and preventing bad field value like M'Hael from ruining your code (the quote in the name would break your SQL statement)
    String sql = "SELECT * from PersonalInfo where FirstName LIKE ? order by FirstName";
    PreparedStatement stmt = connection.prepareStatement(sql);
    stmt.setString(1, "%" + field + "%");
    ResultSet rs = stmt.execute();Cheers,
    evnafets

  • Advanced Keyword Searches (for data on ftp)

    Does anyone happen to know if running an Advanced Google Search will turn up data in the Public folder on my website that is not otherwise linked to my website? I have a couple of websites and I am trying to make sure I understand what is publicly available, what can be "scoured" and downloaded and how careful I really have to be with this.
    I also have a Wordpress Blog that allows for a PASSWORD PROTECTED post but I was not able to find out from their help forum if the Images that were uploaded as part of this post, or the pdf's that were linked to in this post - are in fact available via an Advanced Google Search. Since I upload the pdf's and the images to a Public folder on the site I assume this is the case.
    If so, I'd love to make sure I know how easy it would be for someone to download /all/ of this information.
    THANKS for any tips on this topic.

    888442 wrote:
    Hi,
    We have an existing setup of physical standby database on 11.1.0.7 on Linux (primary 2 node rac)
    Now, the customer has bought licence for Advance compression and we want leverage this in our standby setup.
    The existing parameter what we have is
    log_archive_dest_2 =SERVICE=STDBY_SWPRDENT ARCH ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=STDBY01 NET_TIMEOUT=60
    what changes do i need to change this for advance compression option.Some more reference, Check this manual
    http://docs.oracle.com/cd/B28359_01/server.111/b28294/log_arch_dest_param.htm#BABBFBDI
    http://docs.oracle.com/cd/B28359_01/server.111/b28294/log_transport.htm

  • Search for data name in sapscript

    Is there a program similar to RPINCL10 to search through sapscripts for a data dictionary name. For example I need to find all of the forms that print the data in field MARA-WRKST. I can use RPINCL10 on print programs but not on the sapscripts.

    Hi
    You can find out through where used list in table display (select field-->where used list).
    Regards
    sateesh

  • Inbox Search - Remove "Due date" for search for date

    Dear experts
    We'd like to remove the value "due date" from the dropdown box "Date type" in the agent inbox search.
    How could we achieve that?
    Thanks in advance
    Stephanie

    Thanks Raj.
    When I display the page AuiSearch.htm, I can see the coding for this dropdownbox:
            <crmic:dropdownListBox id                = "DlbDateType"
                                   table             = "<%= controller->G_Datetype_DD %>"
                                   nameOfKeyColumn   = "valpos"
                                   nameOfValueColumn = "ddtext"
                                   selection         = "//SearchAuiItems/DATETYPE"
                                   width             = "100%" />
    However, I don't want to remove it. Currently the dropdownbox contains 2 values:
    "Created Date" and "Due Date".
    I would like to have only "Created Date".
    Thanks in advance
    Stephanie

  • Using JavaScript to search for dates in PDF

    Hello,
    I have a question about using JavaScript in Adobe Acrobat X Pro.
    I want a script that automatically search dates which fall within one week of the date of today.
    If this is true then the pdf file have to be deleted. If the date is later then one week of the date of today then the pdf file must be moved to a different folder.
    I hope anyone can help me with a solution.
    With regards,
    Robert

    Searching is the easy part. The problem is that a script can't delete a
    file, nor can it move a file to another problem.
    On Wed, Jan 7, 2015 at 8:55 AM, RobertZandberg <[email protected]>

  • How do I search for data that's not there?

    Scenario:
    The store managers are supposed to upload the previous days data by 11am the following day.
    I have a table of stores (74 records, 1 for each store) and a table of events (3600+ records,1 for each store per day). When I look at the event data selecting a specific date, I can see I only have 71 records, but I can't easily tell which stores are missing.  I want to gather all the events for a date, then look for the store records and report only if the store is NOT there.  I have tried the following linking options:
    store.store_no (equal to link) event.store_no (gives all 71 event records, as expected, but not the ones that aren't there)
    store.store_no (not equal to link) event.store_no (gives all 71 event records, for each store record, store1, event 1, store1, event2, store2, event1, stove2, event2, etc) I believe this is because it's looking for the store match first, not the date, then the store)
    store.store_no (left outer join) event.store_no (gives all 71 event records, as expected, but not the ones that aren't there at the bottom, like the help states)
    I thought of subreport too, but you can't like on what's not there.
    does anybody have any clues?
    BTW, I'm using 8.5 but can change to 10.
    Thanks,
    Clare

    Carl,
    Thanks so much. I took we a while to get the formatting correct, here's what I ended up with:
    SELECT
        store."store_number", store."address1"
    FROM
        "sac"."store" LEFT OUTER JOIN (SELECT * from "sac"."posj_event"  WHERE  posj_event."business_date" = {d '2009-07-08'} ) ev  ON store."store_number"=ev."store"   
    WHERE
        ev."store" is null
    ORDER BY
        store."store_number" ASC
    My original report was set to look for CurrentDate-1, which translated to {d '2009-07-08'} will that still work here?
    Clare

Maybe you are looking for

  • How to delete email notifications on homescreen co...

    I want to remove it as i set up my yahoo account and it is using my packet data to connect to the internet and using up my credit.. I tried factory restore but it's still there, help?

  • Which version of PS and AI are okay to use?

    Can I use PS and AI from Creative Suite 3 to import into FC4?  Sorry if this is a dumb question, I a novice.

  • Dual Monitor Lag in CS6

    I've been running CS6 on my laptop for the past month with no issues regarding lag. Today I decided to start using an old monitor as a second display, but whenever it's plugged in there is a huge amount of lag within Photoshop - so much lag that it i

  • SeeBurger Message Splitter State accepted or partially accepted

    Hi, The requirement is that if we receive an EDI interchange with multiple transaction sets and if some of them are rejected due to EDI data errors, only those transaction sets in error should be ignored for processing and the ones without errors sho

  • Windows XP resolution issue on 27" iMac

    I've got windows XP installed on my 27" iMac through bootcamp but it's all stretched out. I'm assuming this is because of the high resolution of the 27" iMac and no matter what resolution i choose the screen looks all stretched out. Anyone know a fix