Importing from .txt file

hi, Back again with another question.
This is what i have coded so far. For whatever the reason it will not read in from the .txt file. And i'm not exactly sure what the layout should be considering this time i want to scan in multiple lines from the .txt file. if i do all of my coding in the while loop it should print and then go back and print the next line in order. Or at least i think?
Any advice on the bit of code i have here?
import java.util.Scanner;
import java.io.*;
//counts the number of words, and finds the only in position 4(4th spot in always)
public class file
     public static void main (String[] args) throws IOException
          String MyFile;
          Scanner file;
          file = new Scanner (new File("Test.txt"));
        //keeps scaning when there is another line
          while (file.hasNext());
               float OnlyNumber;
            //displays the original line
               MyFile = file.nextLine();
               System.out.println ("the sentence entered is: " + MyFile);
               String M = MyFile;
               String[]Words = M.split(" ");
               OnlyNumber = Float.parseFloat(Words[3]);
               //If the number is not a whole number round up or down.(needs to be coded)
              float numWords = Words.length;
                 float ExamFinal = OnlyNumber;
              //prints some different messages depending on what the number is
            if (OnlyNumber > 0 )
                System.out.println(Words[3] + "Is a negative number");
            else if(numWords < 50)
                System.out.println(Words.length + "Is the amount of words with the low number" + Words[3]);
            else if(numWords >= 50)
                System.out.println(Words.length + "is the amount of words with the high number" + Words[3]);     
}

My first bit of advice is to follow Java naming conventions. Class names start with an upper-case letter. Methods and fields and variables do not (unless they're constants, in which they're all upper-case).
The if/else statements at the end of the block don't make sense. First, you're checking to see if a number is positive, and if it is you're saying that it's negative.
Then the next two statements talk about "the low number" and "the high number", based on the number of tokens on the line, which (unless there's some weird special pattern with the content in the file) seem like non sequitors to me.

Similar Messages

  • Error when Importing a txt file in FDM 11.1.2

    Hi,
    I'm getting the following error when I try to import a txt file in FDM. I want to load it in HFM
    Error: An error occurred importing the file.
    Detail: Data access error
    ** Begin FDM Runtime Error Log Entry [2010-10-18 13:07:03] **
    ERROR:
    Code............................................. -2147217900
    Description...................................... Data access error.
    Procedure........................................ clsImpProcessMgr.fLoadAndProcessFile
    Component........................................ upsWObjectsDM
    Version.......................................... 1112
    Thread........................................... 10836
    IDENTIFICATION:
    User............................................. admin
    Computer Name.................................... M0A1187649-2009
    App Name......................................... FDM_ONT
    Client App....................................... WebClient
    CONNECTION:
    Provider......................................... ORAOLEDB.ORACLE
    Data Server......................................
    Database Name.................................... orcl
    Trusted Connect.................................. False
    Connect Status.. Connection Open
    GLOBALS:
    Location......................................... OG
    Location ID...................................... 749
    Location Seg..................................... 3
    Category......................................... ACTUAL
    Category ID...................................... 13
    Period........................................... Mar - 2011
    Period ID........................................ 3/31/2011
    POV Local........................................ False
    Language......................................... 1033
    User Level....................................... 1
    All Partitions................................... True
    Is Auditor....................................... False

    To provide some clarity here, this resolved the issue for use also. The good news is that it should be relatively easy for anyone with FDM Workbench access to resolve this given the following information from the FDM DBA guide (http://docs.oracle.com/cd/E17236_01/epm.1112/fdm_dba.pdf):
    To modify the Oracle Work TablespaceName and Oracle Work Table Index
    TableSpaceName configuration settings:
    1 Launch Workbench, and log on to the FDM application.
    2 Select Tools > Configuration Settings.
    3 Select Options > Oracle Work TableSpaceName.
    4 In Name, enter the name of the tablespace, and click Save.
    5 Select Options > Oracle Work Table Index TableSpaceName.
    6 In Name, enter the name you entered in step 4, and click Save.
    7 Select Options > Oracle Work Table Bitmap Index Switch, and set the value to Off for Oracle 10g and Oracle 11g.
    8 Click Save.
    9 Click Close.
    Step 7 specifically resolves this issue.

  • Error while importing the .txt file for SAP script to another system.

    Hi Gurus,
    I'm trying to import the .txt file exported (using RSTXSCRP) from one system to another.But getting the following error on the destination system  (4.6C).I'm able to import the same file on all other releases (Like 470 500,600,604).
    "ERROR: Invalid start marker: SF instead of SFORM "
    Kindly assist..
    Jasvir

    Hi,
    Usually when you download the file and open it with notepad, the first line is like
    SFORMZINVOICE
    ie SFORM followed by form name
    Check this in your downloaded file
    Regards

  • Importing From Flat File with Dynamic Columns

    HI
    I am using ssis 2008,i have folder in which I have Four(4) “.txt” files each file will have 2 columns(ID, NAME). I loaded 4
    files in one destination, but today I receive one more “.txt” file here we have 3 columns (ID, NAME, JOB) how can I get a message new column will receive in source. And how can I create in extra column in my destination table dynamically …please help me

    Hi Sasidhar,
    You need a Script Task to read the names and number of columns in the first row of the flat file each time and store it in a variable, then create a staging table dynamically based on this variable and modify the destination table definition if one ore more
    new columns need to be added, and then use the staging table to load the destination table. I am afraid there is no available working script for your scenario, and you need some .NET coding experience to achieve your goal. Here is an example you can refer
    to:
    http://www.citagus.com/citagus/blog/importing-from-flat-file-with-dynamic-columns/ 
    Regards,
    Mike Yin
    TechNet Community Support

  • Error While Importing from EIF file into AW

    Hi All,
    I am facing the following error while importing from EIF file into AW using AWM as well as from sql prompt.
    java.sql.SQLException: ORA-36786: (IOSEC04) File POCAW/abc.eif does not exist or cannot be accessed.
    ORA-06512: at "SYS.DBMS_AW", line 42
    ORA-06512: at line 1
    at oracle.olap.awm.eif.eifimport.ImportDialogActionThread.doExportOrImport(ImportDialogActionThread.java:172)
    at oracle.olap.awm.eif.EifDialogActionThread.doAction(EifDialogActionThread.java:58)
    at oracle.olap.awm.ui.dialog.ThreadedDialogActionThread.run(ThreadedDialogActionThread.java:49)
    i have already created the directory pocaw.
    i have done the following steps :
    CREATE OR REPLACE DIRECTORY POCAW as 'D:\Olap_POC\export';
    GRANT all ON DIRECTORY POCAW to PUBLIC;
    execute dbms_aw.execute ('aw create ''POC_AW''');
    execute dbms_aw.execute('cda pocaw');
    execute dbms_aw.execute('dtb attach POC_AW rw');
    execute dbms_aw.execute('import all from eif file ''/abc.eif'' dfns update ');
    any idea or thought would be appreciable.
    thanks n advance
    anwar

    execute dbms_aw.execute('import all from eif file''/abc.eif'' dfns update ');
    Maybe one of the following file names could help
    (have never tried it):
    ''abc.eif''
    ''POC_AW\abc.eif''Yes,
    you don't need the slash. CDA is like setting a default directory.

  • Import From CSV File statement runs forever, no error, does not finish

    Hello,
    I am trying to import a CSV file in a JAVA program, with the following statement:
    IMPORT FROM CSV FILE '/debug/testdatabase/FILE.csv'
    INTO "JOSEPH"."TEST_TABLE"
    WITH COLUMN LIST IN FIRST ROW
    RECORD DELIMITED BY '\n'
    FIELD DELIMITED BY '\t' ERROR LOG '/debug/testdatabase/file.err'
    THREADS 10
    BATCH 10000
    I have two HANA instances on different machines A and B:
    Both machines run HANA version 1.00.74.00.389160 (NewDB100_REL), while the OS is
    SUSE Linux Enterprise Server 11.1 on machine A and
    SUSE Linux Enterprise Server 11.2 on machine B.
    The statement above runs fine on machine A and the rows are imported properly from JAVA as well as when executed from HANA Studio SQL console.
    If I copy the file to machine B and try the exact same statement with the same file, it does not finish (neither from JAVA nor from HANA Studio SQL console). There is no error either. It cannot be cancelled, only a HANA restart stops the statement. Also the sample file I use has only 2 rows, and memory does not seem to be a problem.
    I seem to have a similar problem to the one described here, but the answers there do not help me: http://scn.sap.com/thread/3396582 I specified the record delimiter, and I used a python script to check for any strange characters that are not supposed to be there, but didn't find any.
    If I copy the file to my windows PC and use the "File Menu -> Import -> SAP Hana Content -> Data from Local file" function, it imports the file correctly into B, but I need to be able to do it from JAVA.
    Machine A administration view:
    Machine B administration view:
    If you have any idea what might cause this behavior or where I can find more information on this problem please give me a hint.

    Hi Joseph,
    First from the pics, the revision of your SAP HANA instance is 73 instead of 74. Since I have no identical environment, I cannot test it for you. But can you try the simplest scenario? You can create a table with only one column table try to import a CSV file with only one row.
    Best regards,
    Wenjun

  • "Import from Text File" & "Upload from Clipboard" icon not appearng in F110

    Hi Experts,
    While making the payment to the vendors through TN F110, in "PARAMETER" screen just next to 'STATUS' screen, there is a vendor field for selection in range and just ahead of this there is an icon for multiple vendor selection ( Bold arrow mark ). If I click on that multiple vender selection icon ( on bold arrow mark ), an another screen opens for multiple selection for vendors. In this screen 'Enter, Copy, Delete etc' icons are appearing at the bottom of the screen but "Import from Text File" & "Upload from Clipboard" icon are not appearing there.
    Can you please let me know how to bring that icons there?
    Points would be awarded.
    Rgds,
    Shailesh

    Hi Ravi,
    I have not yet created anything and have just entered the parameter. In the multiple screen for vendors there are 5 fields for individual and 5 for range selection. Even you can put more than five range selections or individual selections by clicking on the page button but there I am not finding these two icons.
    Can you please check at your end and let me know if you are getting or what to do to bring those two icons in F110.
    Rgds,
    Shailesh

  • Problem in importing from dmp file

    Hi ,
    I am facing problem while importing from dmp file on unix server
    Error is as follows :
    Export file created by EXPORT:V08.01.07 via conventional path
    IMP-00013: only a DBA can import a file exported by another DBA
    IMP-00000: Import terminated unsuccessfully
    Export taken was with user xxx@yyy
    import command is : imp xxx/ppp file=abc.dmp TABLES=xxx.table1 ignore=y feedback=500
    please help me out.
    Atul Chougule

    I tried with FROM USER / TO USER , but the result is same.
    $ imp uuu/ppp file=aaa.dmp fromuser=uuu touser=uuu ignore=Y
    Import: Release 8.1.7.3.0 - Production on Thu Jun 15 06:44:49 2006
    (c) Copyright 2000 Oracle Corporation. All rights reserved.
    Connected to: Oracle8i Enterprise Edition Release 8.1.7.3.0 - Production
    With the Partitioning option
    JServer Release 8.1.7.3.0 - Production
    Export file created by EXPORT:V08.01.07 via conventional path
    IMP-00013: only a DBA can import a file exported by another DBA
    IMP-00000: Import terminated unsuccessfully
    I am stucked up ,Dont know what to do .

  • Error importing from BIAR file (BO XI 3.0)

    Dear BO community,
    I am using the BIAR tool for backup purposes. For my backup, I use a properties file as input which looks like the one shown below:
    action=exportXML
    exportBiarLocation=C:/Temp/BOBackup.biar
    userName=Administrator
    password=XXX
    CMS=XXX:6400
    authentication=secEnterprise
    includeSecurity=true
    exportDependencies=true
    exportQuery1=select * from ci_infoobjects
    exportQuery2=select * from ci_systemobjects
    exportQuery3=select * from ci_appobjects
    exportQueriesTotal=3
    The file creation seems to work without any problems. A file is created. However, when importing the file into another CMS, I am getting the following error:
    Failed to open the BIAR file. Reason: com.businessobjects.sdk.biar.om.internal.iw.ObjectManagerIWException:Input/Output exception occurred: 'Couldn't find entry 'BusinessObjects.xml'.
    I have opened the BIAR file using a ZIP program and checked that there is no "businessobjects.xml" file in there. When creating BIARs using only a single query, this file exists and the import is no problem.
    Does anyone have an idea what's happening and can help me?
    Thank you and best regards!

    Hello ALL,
    I have the same problem when I am trying import from BIAR file. Please tell me how you resolved this issue.
    I did not understand much from your previous message.
    We are using BO XI R3.1 and below is the error message that Import Wizard is throwing.
    Failed to open the BIAR file. Reason: com.businessobjects.sdk.biar.om.internal.iw.ObjectManagerIWException:required dependencies not found target system : 'AWAS3XkMSEtGn1TXI370kAU'
    In both pc  BO version is boxir3.1 sp3 and currently i m using windows xp professional version 2002 sp3
    Thanks
    Saurabh shivam

  • Cannot import a txt file in BPC7.5 with amounts containing ","

    Hello all,
    When importing a txt file in BPC7.5 (through standard Import package)
    with amounts containing format xxx,xxx,xxx.xx (where "," is the thousand separator and "." is the
    decimal separator), the importlog file displays that everything is ok.
    However, looking into the report, we see that the amounts are cut off by
    the first thousand separator.
    for example: 3,096.54 has been imported in BPC7.5 as 3  !!!!
    OS : Windows Server 2008 R2(RTM)
    SQL : SQL Server 2008 R2
    BPC 7.5 SP4.
    - The formatting in my Excel 2007 is like this 3,096.54 (so three
    thousand ninety six and 54 cents).
    - The amounts in the SQL table are not correct: in our example,
    we see in the table 3 in stead of 3,096.54
    - My regional settings are indeed English (US) and my decimal separator
    is a point.
    - My delimiter is ";" (semi colon) in transformation file as well as in
    data file.
    Can anyone help me please.
    Best Regards,
    Jico

    Hello Jico,
    I have exactly the same problem. It's not yet solved, but here are some steps I've already done.
    When you open your transformationfile you use to import the data and when you "validate and process" it against the file you want to import, you can see a preview in "output log". Here you can see that automatically your separator (whatever it may be) has been replaced by "," (comma). Since the system uses the comma as column delimiter, I understand that the amount is being cut off at the first thousands separator (being a comma).
    In order to solve this, I tried to use the parameter "OUTPUTDELIMITER" and set it to ";" (in the transformation file):
    OUTPUTDELIMITER=;
    This forces the system to use ";" in the "output log". Now the system can not interpret the "," as a new column.
    However when we execute the import, we get following error message:
    Mapping error: The following doesn't exist in the data file header.[Measure field
    I found something very similar about this error message on:
    Mapping Error : MEASURE FIELD
    This thread is marked as answered, but it's not really telling what to do exactly...
    Best Regards,
    Jonathan

  • How to read data from txt file respectively

    Hi,
    I am triying to form an equation between two known points. I want to do this with the attached VI, the most critical point is that I will read the x1, y1, x2 and y2 coordinates from the same .txt file. They will be written in a .txt file and I will send them to the appropriate channel (x1, y1, x2 and y2) respectively. How can I get data in a rule from a .txt file?
    Could anyone please help me with this issue,
    Best regards. 
    Attachments:
    read from txt file.vi ‏8 KB

    Dear RavensFan,
    Thank you very much for your helps, I am bit new to labview so I usually can not find the appropriate functions easily. And a new problem has rised in my application. I should write the A, B and C numbers in the respective series to the file 2.txt. I am able to write them in a straight forward case but I want to write the next triples (A B C) in the next row. Like this;
    A1 B1 C1
    A2 B2 C2
    A3 B3 C3
    So how can I put new line constant and space constant to my VI? 
    Waiting for your valuable helps,
    Best regards,
    Attachments:
    read_from_txt_fileMOD.vi ‏18 KB

  • Remove string from txt file

    Hello guys,
    I need some help. I have to remove some content of Tolerance "column" (see attach). The string which I wish to remove is "+/- 0s" and replace it with an empty string. I need to remove this for each row where "+/- 0s" appears.  
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    sample.txt ‏3 KB

    Hi Samoth,
    I dont know if I understood your requirement properly, but please check the attached snippet if it helps.
    If this does not satisfy your requirement, then please give some more details.
    Attachments:
    Remove string from txt file.png ‏21 KB

  • How to get Text from (.txt) file to display in the JTextArea ?

    How to get Text from (.txt) file to display in the JTextArea ?
    is there any code please tell me i am begginer and trying to get data from a text file to display in the JTextArea /... please help...

    public static void readText() {
      try {
        File testFile = new File(WorkingDirectory + "ctrlFile.txt");
        if (testFile.exists()){
          BufferedReader br = new BufferedReader(new FileReader("ctrlFile.txt"));
          String s = br.readLine();
          while (s != null)  {
            System.out.println(s);
            s = br.readLine();
          br.close();
      catch (IOException ex){ex.printStackTrace();}
    }rykk

  • TS1424 I have just opened iTunes and only the music that I have purchased from the iTunes store is being shown: I can't find any of the music that I have imported from a file. Help?

    I have just opened iTunes and only the music that I have purchased from the iTunes store is being shown: I can't find any of the music that I have imported from a file. Help?

    See this post.
    tt2

  • Can you use a subquery when importing from a file?

    I was wondering if the DBMS_DATAPUMP API allows using a subquery (DATA_FILTER) when executing an import from a file?
    I am unable of limiting my data when creating the export file because my subquery requires a database link, which is not an option on the server I'm working on. So I'm wondering if I can limit my data on the import from a file, rather than the export?
    Thanks for any advice...
    ivalum21

    I was wondering if the DBMS_DATAPUMP API allows using a subquery (DATA_FILTER) when executing an import from a file?From the documentation I would say yes:
    SUBQUERY:
    Specifies a subquery that is added to the end of the SELECT statement for the table. If you specify a WHERE clause in the subquery, you can restrict the rows that are selected. Specifying an ORDER BY clause orders the rows dumped in the export which improves performance when migrating from heap-organized tables to index-organized tables.
    «

Maybe you are looking for

  • Cannot create SAPUI5 UI Component from a BPM Process

    Dear friends, For a very strange reason I am not able to create a SAPUI5 UI Component from a BPM Process. I am trying to create SAPUI5 UI's for an Human task as part of my BPM process. I am using NWDS 7.3 EHP1 SP15 PAT0000. We are using NWDI developm

  • Action script and default values

    While importing data through action script, even if the property value present in Action script is same as default value defined at the property level , DRM marks that property value as Overridden in the hierarchy. Is there any possible way to avoid

  • My webpage with parallax scroll effects flickers in internet explorer 11. How can I fix this?

    My webpage with parallax scroll effects flickers in internet explorer 11, when using the mouse wheel or the arrows in the scroll bar - Parcerias | Agrupamentos de Escolas | EEA | DGE It works fine in firefox, chrome and safari. How can I fix this? Th

  • How do I include gradation filters in Photoshop CS4?

    I used to posses coloured gradation filters for my camera, but unfortunately no more and would like to imitate this effect on some images using Photoshop CS4.  I have heard that it is possible to include these but don't know how.  Can anyone help ple

  • Activate Further Information Flexfield

    Hi there, I cant select any values in the field Further Information in the Payroll Element Description screen. Where can I activate this field? Is this a Profile option what I have to activate or is there a setting/data missing in the Business Group