Help With String parsing

Hey guys,
I need some help with String Parsing. i hope experts here will help me.
i'm reading a text file and getting data as String in this format
*ABR, PAT MSSA        2009       7001    B   ABC       Y
*VBR, SAT ZSSA        2008       5001    A   CED       N
*ABC, AAT CSSA        5008       001     A   AZX       N
*CBC, CAT FSSA        308        5001    A   XCV       N
Now from following lines i have to extract Number data i.e. 2009 and 7001 from 1st line. 2008 and 5001 from 2nd line and so on.
Can anyone pls suggest me any way to get the data that i want from these Strings
Thanks for your time to read this.
Regards,
sam

Thanks for the reply
Data length can vary. ABR, PAT is the last name, First Name of the Users.
it can be following or any other combination. i just need 2 set of numbers from the complete line rest i can ignore. Any other way to get that
*ABRaaassd, PATfffff MSSA 2009 7001 B ABC Y
*VBRaa, SATaa ZSSA 2008 5001 A CED N
*ABC, AAT CSSA 5008 001 A AZX N
*CBC, CAT FSSA 308 5001 A XCV N                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • PLEASE help with JavaScript parsing of WSDL return

    Can someone help with parsing return WSDL data?
    My return WSDL data is a concatenated string of alias names (firstname middlename lastname generation) delininated with an "@":
    7433|ALIAS|John|W|Smith| @7432|ALIAS|Johnny| |Smith| @7430|ALIAS|JJ| |Smithers| @7431|ALIAS|JJ| |Smith| @7400|ALIAS|Jon| |Smith| @7416|ALIAS|John|Wilber|Smith|JR
    I must have these names appear on my forms in a "lastname, firstname middlename generation" format. Can anyone provide expertise in this area if I provide the table.column reference?
    alias.alternate_id = tmp[0];
    alias.type = tmp[1];
    alias.firstname = tmp[2];
    alias.middlename = tmp[3];
    alias.lastname = tmp[4];
    alias.generation = tmp[5];

    Can someone help with parsing return WSDL data?
    My return WSDL data is a concatenated string of alias names (firstname middlename lastname generation) delininated with an "@":
    7433|ALIAS|John|W|Smith| @7432|ALIAS|Johnny| |Smith| @7430|ALIAS|JJ| |Smithers| @7431|ALIAS|JJ| |Smith| @7400|ALIAS|Jon| |Smith| @7416|ALIAS|John|Wilber|Smith|JR
    I must have these names appear on my forms in a "lastname, firstname middlename generation" format. Can anyone provide expertise in this area if I provide the table.column reference?
    alias.alternate_id = tmp[0];
    alias.type = tmp[1];
    alias.firstname = tmp[2];
    alias.middlename = tmp[3];
    alias.lastname = tmp[4];
    alias.generation = tmp[5];

  • Please Help with text parsing problem

    Hello,
    I have the following text in a file (cut and pasted from VI)
    12 15 03 12 15 03 81 5 80053 1 1,2,3 $23.00 1 ^M
    12 15 03 12 15 03 81 5 84550 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 84100 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 83615 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 82977 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 80061 1 1,2,3 $44.00 1 ^M
    12 15 03 12 15 03 81 5 83721 1 1,2,3 $15.00 1 ^M
    12 15 03 12 15 03 81 5 84439 1 1,2,3 $44.00 1 ^M
    12 15 03 12 15 03 81 5 84443 1 1,2,3 $40.00 1 ^M
    12 15 03 12 15 03 81 5 85025 1 1,2,3 $26.00 1 ^M
    12 15 03 12 15 03 81 5 85008 1 1,2,3 $5.00 1 ^M
    this method reads the text from a file and stores it in a ArrayList
        public ArrayList readInData(){
            File claimFile = new File(fullClaimPath);
            ArrayList returnDataAL = new ArrayList();
            if(!claimFile.exists()){
                System.out.println("Error: claim data - File Not Found");
                System.exit(1);
            try{
                BufferedReader br = new BufferedReader(new FileReader(claimFile));
                String s;
                while ((s = br.readLine()) != null){
                         System.out.println(s + " HHHH");
                        returnDataAL.add(s);
            }catch(Exception e){ System.out.println(e);}
            return returnDataAL;
        }//close loadFile()if i print the lines from above ... from the arraylist ... here is waht i get ...
    2 15 03 12 15 03 81 5 80053 1 1,2,3 $23.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84550 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84100 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 83615 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 82977 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 80061 1 1,2,3 $44.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 83721 1 1,2,3 $15.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84439 1 1,2,3 $44.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 84443 1 1,2,3 $40.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 85025 1 1,2,3 $26.00 1 HHHH
    HHHH
    12 15 03 12 15 03 81 5 85008 1 1,2,3 $5.00 1 HHHH
    HHHH
    I see the ^M on the end of the lines ... but i dont understand why im getting the blank lines
    in between each entry ... I printed "HHHH" just to help with debugging ... anyone have any ideas why i am getting the extra blank lines?
    thanks,
    jd

    maybe its a FileReader deal.. Im not sure, maybe try using InputStreams. This code works for me (it reads from data.txt), give it a try and see if it works:
    import java.io.*;
    public class Example {
         public Example() throws IOException {
              BufferedReader b = new BufferedReader(new InputStreamReader(new FileInputStream("data.txt")));
              String s = "";
              while ((s = b.readLine()) != null) {
                   System.out.println(s);
              b.close();
         public static void main(String[] args) {
              try {
                   new Example();
              catch (IOException e) {
                   e.printStackTrace();
    }

  • Help with string object code

    Hello,
    First off thanks in advance to anyone who helps. I am trying to write a program that using a class string object to convert this kind of "text speech" to english. For example if the user inputs "HowAreYou?", I want the program to output "How are you?" I am having too much trouble with strings for some reason. This is what I have so far and I am not sure where to go from here. Should I use a do loop to check through the input string until it is done seperating the words? And how should I go about doing that?
    import java.util.Scanner;
    public class P8
    public static void main( String args[] )
    char choice;
    String line = null;
    String answer = null;
    Scanner scan = new Scanner(System.in);
    do
    System.out.println();
    System.out.print("ENTER TextSpeak sentence(s): ");
    line = scan.nextLine();
    System.out.print( "Converted to English: \t ");
    System.out.print( textSpeaktoEng( line ) );
    System.out.println();
    System.out.print("Want more TextSpeak?\t\t ");
    answer = scan.next();
    choice = answer.charAt(0);
    if( scan.hasNextLine() )
    answer = scan.nextLine();
    }while(choice != 'N' && choice != 'n');
    public static String textSpeakToEng(String s)
    String engStr = null;
    if( Character.isUpperCase( s.charAt(j) ) )
    engStr += ? ?;
    engStr += Character.toLowerCase( s.charAt(j) );
    scan.close();
    }

    I got my program to compile and run but I have a problem. If I input something like "ThisForumIsGreat" it will output just "t f i g" in lower case letters. Any suggestions?
    import java.util.Scanner;
    public class P8
    public static void main( String args[] )
       char     choice;                          // Repeat until n or N                                             
       String line   = null;                     // Sentences to toTextSpeak
       String answer = null;                     // Repeat program scan
       Scanner scan = new Scanner(System.in);    // Read from keyboard
       do
          System.out.println();
          System.out.print("ENTER TextSpeak sentence(s): ");
          line = scan.nextLine();                // Read input line
          System.out.print( "Converted to English: \t    ");
          System.out.print( textSpeakToEng( line ) );
          System.out.println();
          System.out.print("Want more TextSpeak?\t\t ");
          answer = scan.next();                  // Read line, assign to string
          choice = answer.charAt(0);             // Assign 1st character
          if( scan.hasNextLine() )               // <ENTER> character
            answer = scan.nextLine();            // Read line, discard
      }while(choice != 'N' && choice != 'n');    // Repeat until input start n or N
    public static String textSpeakToEng(String s)
       String engStr = null;  
       int i;  
       for ( i = 0; i < s.length(); ++i )
       if( Character.isUpperCase( s.charAt(i) ) )
         engStr += " ";                                  // Append 1 blank space
         engStr += Character.toLowerCase( s.charAt(i) ); // Append lowercase
       return( engStr );
    }

  • Need help with input, parsing, and loop in one program

    I am doing an assignment that is supposed to:
    # ask the user for a URL
    # For the entered URL, read all the HTML text from the page and extract all links (other URLs) and image names. These should be printed to the console window.
    # Reprompt for a URL until the user presses the cancel button.
    # Define at least one helper method that serves a practical purpose that your main method will use. Note that your method(s) should serve a useful purpose, and it should make sense that they are separated out from the main method.
    So far, I figured out how to ask if the user would like to play again, though I can't make it loop to play again. The "NO_OPTION" works fine and exits out.
    I cannot figure out at all how to ask for the URL and then use that URL to try to parse the HTML to find the links and pictures.
    for the loop, is it:
    do{
    ...//all the stuff//
    }while (option == JOptionPane.YES_OPTION) ?(I think I have to parse, looking for "img src" and "a href", anyway)
    The biggest thing I'm getting hung up about is where to start. All it'll do is ask for the URL, say there is an error, and ask if I want to do it again. Don't know how to make it loop again. Like I said, I think it's a do while loop but am not completely sure where it goes and how to have it work on the entire thing with message dialoge boxes
    To ask for the input, I was trying to make the dialoge box a string so the string would be displayed and have the links extracted
    String linkString=   
              JOptionPane.showInputDialog("Please enter a URL:");...but it obviously doesn't work like that...
    Here is the whole mess so far...I don't know what my question is because I know what I want, just not the terms to ask. help?
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import javax.swing.JOptionPane;
    public class WebPageExaminer
         public static void main(String[] args)
              String linkString=   
              JOptionPane.showInputDialog("Please enter a URL:");
        String link = null;
        URL url;
        URLConnection urlC;
        InputStream inStream;
        InputStreamReader inStreamReader;
        BufferedReader reader;
        try
        url = new URL(link);
        urlC = url.openConnection();
        inStream = urlC.getInputStream();
        inStreamReader = new InputStreamReader(inStream);
        reader = new BufferedReader(inStreamReader);
        String inputLine = reader.readLine();
        while (inputLine != null)
          System.out.println(inputLine);
          inputLine = reader.readLine();
        catch(Exception e)
          JOptionPane.showMessageDialog(null, "Error reading from file");
        } int answer = JOptionPane.showConfirmDialog(null, "Examine Another URL?", "Click Yes or NO:", JOptionPane.YES_NO_OPTION);
        if (answer == JOptionPane.NO_OPTION)
             System.out.println("Goodbye");
             System.exit(0);
              if (answer == JOptionPane.YES_OPTION)
                  System.out.println("OK!");
    }Edited by: digital.tradecraft on Mar 14, 2009 1:27 PM

    You posted the questions 20 minutes ago? Why are you bumping it. People answer questions when they know the answer.
    I tend to ignore people who expect an immediate answer.

  • Newbie Help With File Parser

    I have an assignment that involves using Java to parse the info on one text file and output to another text file with a header row and a data row both of which need to be tab delimited. I'm relatively new to Java and I'm having a hard time even starting this thing. Any help would be greatly appreciated. The file I have to read from is similar to this:
    Report: Fake Report for Fake Loans
    Report ID: 000001
    Run Date: 04/25/2007
    Office Number ID Number DelqMessage
    033 000101000 N
    034 001234875 Y
    035 123456789 N
    I would essentially need to get all the field names into the header row and the data in the row below it.
    Thanks in advance.

    I have been working on this and I almost have it working correctly. I was able to selectively pull the info I need from the original file and I can output to the new file in a vertical form. The last step is to output a header that says RunDate Office Loan DelqMessage with a tab delimiter. I than have to compile the data and output in rows under the header also in tab delimited format. I think I'm right there but I still get one error I cannot resolve of:
    Error: java.lang.StringIndexOutOfBoundsException: String index out of range: 4
    It is very vague and I have tried everything I can think of to locate the issue so it can be debugged. Below is a copy of the file I'm trying to parse followed by what I have for code so far. Any help would be greatly appreciated.
    Sample of report:
    Report: Fake Report for Fake Loans
    Report ID: 000001
    Run Date: 04/25/2007
    ASC Number Loan ID DelqMessage
    033 000101000 N
    034 001234875 Y
    035 123456789 N
    ASC Number Loan ID DelqMessage
    036 741258963 N
    037 872563987 N
    038 987521455 Y
    ======================================================================
    Fake Report Summary:
    ASC Total: 6
    Loan Total: 6
    Total Delq: 2
    Code:
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.BufferedReader;
    import java.io.PrintWriter;
    import java.io.IOException;
    public class ParseFile {
    public static void main(String[] args) throws IOException {
         // Variable Declaration
         boolean procOn;
         String RunDate = "";
         BufferedReader inputStream = null;
    PrintWriter outputStream = null;
         // Following block of code parses FakeReportToParse.txt and outputs
         // needed portions of the report to characteroutput.txt
    try {
         procOn=false;
         inputStream =
    new BufferedReader(new FileReader("FakeReportToParse.txt"));
    outputStream =
    new PrintWriter(new FileWriter("characteroutput.txt"));
    String l;
    while ((l = inputStream.readLine()) != null) {
         outputStream.println("Rundate\tASCNumber\tLoan\tDelqMessage");
         if (l.indexOf("Run Date:")>=0) {
              RunDate = l.substring(10);
              outputStream.println(RunDate);
         // Processing of report data
         if(l.indexOf("ASC Number Loan ID") >= 0) {
              procOn = true;
         if(l.indexOf("-------------------------") >= 0 || l.indexOf("===============================") >= 0) {
              procOn = false;
         // Output report data to new characteroutput.txt file
         if(procOn) {
              String ASC = l.substring(0, 4).trim();
              String LoanID = l.substring(15, 25).trim();
              String DelqM = l.substring(30).trim();
         outputStream.println(RunDate + "\t" + ASC + "\t" + LoanID + "\t" + DelqM);
         catch(Exception z){
    System.out.println("Error: " + z.toString());
    }

  • Urgent help with string tokenizing.

    Hello Everyone,
    I'm 4 months new to Java and JSP.
    Can some one help me with a small favor please, my program below reads from a file and Tokenize the string, the top layer of the string is OK however I want to write another method to tokenize off of the top layer it must be in a separate method because I want to call the method on a JSP page. Can someone view my code and help me with the other method please.
    Thanks
    KT
    package dev;
    import java.io.*;
    import java.util.*;
    public class RoundDetail2
    public String string_gameID;
    public String string_roundID;
    public String string_bet;
    public String string_win;
    public String string_roundDetail;
    public String string_date_time;
    public String tokenizer_topLayer;
    public String readDetail_topLayer;
    public static final String SUITS[] = {" ", "Clubs", "Hearts", "Spades", "Diamonds", "Joker", "FaceDown"};
    public static final String VALUES[] = {"Joker ","Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
    public static final String SuitVALUES[] = {" ","1","2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"};
    public RoundDetail2() throws FileNotFoundException
    DataInputStream inFile=
                 new DataInputStream(
                    new BufferedInputStream(
                   new FileInputStream("C:/apps/jakarta-tomcat-4.0.6/webapps/ROOT/WEB-INF/classes/dev/Data_452SY2.txt")));
    try { 
                 if((readDetail_topLayer = inFile.readLine()) != null)
              StringTokenizer tokenizer_topLayer = new StringTokenizer(readDetail_topLayer,"\t", true);
                   if (tokenizer_topLayer.hasMoreTokens())
                        string_gameID = tokenizer_topLayer.nextToken();
                        string_roundID = tokenizer_topLayer.nextToken();                                   
         catch(IOException e)
                    System.out.println(e.getMessage());
         

    If you are trying to read tab delimited file and tokenize the contents, the code should be as below:
    package dev;
    import java.io.*;
    import java.util.*;
    public class RoundDetail2 {
         public String string_gameID;
         public String string_roundID;
         public String string_bet;
         public String string_win;
         public String string_roundDetail;
         public String string_date_time;
         public String tokenizer_topLayer;
         public String readDetail_topLayer;
         public static final String SUITS[] = {" ", "Clubs", "Hearts", "Spades", "Diamonds", "Joker", "FaceDown"};
         public static final String VALUES[] = {"Joker ","Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
         public static final String SuitVALUES[] = {" ","1","2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"};
         String gameInfoText = "";
         public RoundDetail2() throws FileNotFoundException
              DataInputStream inFile = new DataInputStream(new BufferedInputStream(
                                            new FileInputStream("C:/apps/jakarta-tomcat-4.0.6/webapps/ROOT/WEB-INF/classes/dev/Data_452SY2.txt")));
              try
                   while((readDetail_topLayer = inFile.readLine()) != null)
                        gameInfoText += readDetail_topLayer;
              }     catch(IOException e)
                   System.out.println(e.getMessage());
         public void getGameInfo()
              StringTokenizer tokenizer_topLayer = new StringTokenizer(gameInfoText,"\t", false);
              while (tokenizer_topLayer.hasMoreTokens())
                   string_gameID = tokenizer_topLayer.nextToken();
                   string_roundID = tokenizer_topLayer.nextToken();
                   System.out.println(string_gameID+" : "+string_roundID);
         public static void main(String[] args)
              try
                   RoundDetail2 roundDetail = new RoundDetail2();
                   roundDetail.getGameInfo();
              }catch(Exception e){}
    Test if it works for you by running at command prompt.
    Goodluck
    -Mak

  • Need help with string field formula

    Post Author: dshallah
    CA Forum: Formula
    What I am trying to accomplish:
    The report has item numbers and each item number has the
    potential to be associated with up to three u2018binsu2019. So the fields are u2018item
    numberu2019, u2018bin1, u2018bin2u2019 and u2018bin3u2019.
    I tried to write a u2018if thenu2019 statement that would only show
    records that had a value of less than 1 in each u2018binu2019 field. When I try to
    write the statement I get a message that says u2018A string is required hereu2019 and
    it highlights the number 1 in my statement. I have a feeling itu2019s because the u2018binu2019
    fields are string fields and not number fieldsu2026? So I am not sure the proper
    procedure to correct this. Thus help is needed and appreciated.
    Here is what I wrote:
    if {IC_LOC_HIST.BIN_NAME_1} < 1 then
    {IC_LOC_HIST.BIN_NAME_1}
    What is correct way to write a statement that will show me
    the zero values in each column of bin fields?
    Thanks!

    Post Author: bettername
    CA Forum: Formula
    You must have a non-numeric value in there somewhere - up in the top left of the formula editor window, it'll show you the variables you've passed to the formula, which should help track down what's going on.
    You could try and check that the value is a number first by using something like:
    if isnull({IC_LOC_HIST.BIN_NAME_1}) = false and isnumeric({IC_LOC_HIST.BIN_NAME_1}) = false and then "Error - Should be a Number!"
    else
    if isnumeric({IC_LOC_HIST.BIN_NAME_1}) = true and tonumber({IC_LOC_HIST.BIN_NAME_1})<1 then {IC_LOC_HIST.BIN_NAME_1})

  • Simple help with DOM parsing - urgent

    hi,
    i'm new to xml parsing and have a simple (i think) question.
    i have the following xml
    <record>
    <header>
    <id>1</id>
    </header>
    </record>
    <record>
    <header>
    <id>1</id>
    </header>
    </record>
    i'm trying to parse first the records then from a record parse the header and from it get the id in the following way:
    NodeList nodeList = org.apache.xpath.XPathAPI.selectNodeList(doc, "//*[name() = 'record']");
    for every element i in the nodeList
    Node node1 = nodeList.item(i);
    Node node2 = org.apache.xpath.XPathAPI.selectSingleNode(node, "//*[name() = 'header']");
    Node node3 = org.apache.xpath.XPathAPI.selectSingleNode(node2, "//*[name() = 'id]");
    String id = node3.getFirstChild().getNodeValue();
    even due i run in a loop and i see node1 containing the right record the other parsing gives me the always the data of the first record.
    can't i parse and then re-parse on the node i got?
    if the second parsing always done from the root, even due i gave the parser another node?
    what am i doing wrong?
    thanks in advance
    alon

    Your xpath & everything else looks right. I have 2 questions...
    1 -- what is the length of NodeList nodeList = org.apache.xpath.XPathAPI.selectNodeList(doc, "//*[name() = 'record']"); ?
    The answer should be 2, you have 2 record from the XML
    2 -- both id of your record is 1. Are you seeing the same value returned because of this? What do you see if you change the second record's id to 2 ??

  • Help with DOM Parser

    Hello! I am writing a JRXML file with XML extension and trying to parse using DOM Parser.But I am getting the following Exception:
    java.net.UnknownHostException: jasperreports.sourceforge.net
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at sun.net.NetworkClient.doConnect(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.<init>(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
         at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
         at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
         at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
         at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
         at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
         at net.zycomm.reportGeneration.source.WriteJrxml.<init>(<myfilename.java>.java:44)
         at net.zycomm.reportGeneration.source.WriteJrxml.main(<myfilename.java>).
    I need another answer:How can I parse a JRXML file?

    it is a network problem, I think the DNS of your provider is not up to date so it cannot find the domain.
    There must be a schema declaration at the beginning of your JRXML file. It points to a schema situated on the jasper site (which has changed recently).
    The better turnaround is to find this schema, place it on your local file system (or in server's hierarchy) and to change the schema definition in the jrxml file to point to the local file

  • Can anyone help with string manipulation please?

    I am trying to change this string 43180-1-0001-37 into the following expression 43181-0001-37
    It is a string for Project No + Job Phase + Drawing No + Item No.
    The reduction of '43180' to '4318' is causing me the problem, I have the concatenation.
    Current report code is
    SELECT Os.[Orderno-o] As 'Order Number'
    ,Ph.PH_PHASE_NO + '.' + Re.REQUISITION_NUMBER As 'Req. Number'
    ,Pl.ID As 'Item ID'
    ,@CurrentProjectNumber + '-' + Ph.PH_PHASE_NO + '-' + Dr.DRAWING_NO + '-' + Cast(Pl.ITEM_NO As varchar(max)) As 'Drg & Item No.'
    It is this line giving me the problem?
    ,@CurrentProjectNumber + '-' + Ph.PH_PHASE_NO + '-' + Dr.DRAWING_NO + '-' + Cast(Pl.ITEM_NO As varchar(max)) As 'Drg & Item No.'

    Hi uh... Mr. Rubbish at SQL :)
    Unfortunately, there are many elements in your questions which aren't clear:
    1. What is the content in your columns PH_PHASE_NO, DRAWING_NO, ITEM_NO and what is their data type?
    2. What is the content of the variable @CurrentProjectNumber and what is its data type?
    3. It's unclear what is the logic behind the "reduction" of '43180' to '4318'. Do you want to remove trailing zeros? Shorten the value by one character? Because from what I see in your first sentence, it seems like you simply want to add 1 to '43180'
    and turn it into '43181'. That's a simple +1 operation. I also notice that you want to remove the "Job Phase" part from the string (which is "1" in your case)? Or do you need to add its value to the "Project No" (43180)? It's
    all quite confusing.
    Clarification would be highly appreciated.
    I would suggest, if you can, to please explain what you need NOT by specific examples, but by explaining your requirements IN GENERAL. In other words, don't use specific values like '43180', but start with a variable like 'X', and then let us know specifically
    what operation you want to perform on it (e.g. 'add 1' / 'remove trailing zeros' / 'shorten by one character' / 'add to it the value of some column' etc.). This will make it easier to understand the algorithm needed.
    Eitan Blumin; SQL Server Consultant - Madeira Data Solutions;

  • Need a little help with strings

    So I would like to have the user input a month by using the abbreviation ex. (mar or apr) instead. So I want month to be a string right? When I tried that I get an error. What should this look like?
    import java.util.*;
    public class MonthSwitch
      static Scanner console = new Scanner(System.in);
      public static void main(String[] args)
        int month;
        System.out.print("Enter a Month: ex. Jan, Feb, Mar ect...");
        month = console.nextInt();
        System.out.println();
        switch (month)
          case 1: System.out.println("First Quarter");
          case 2: System.out.println("First Quarter");
          case 3: System.out.println("First Quarter");
                  break;
          case 4: System.out.println("Second Quarter");
          case 5: System.out.println("Second  Quarter");
          case 6: System.out.println("Second  Quarter");
                  break;
          case 7: System.out.println("Third Quarter");
          case 8: System.out.println("Third Quarter");
          case 9: System.out.println("Third Quarter");
                  break;
          case 10: System.out.println("Fouth Quarter");
          case 11: System.out.println("Fouth Quarter");
          case 12: System.out.println("Fouth Quarter");
                  break;
          default: System.out.println("Sorry Input is Invalid");
    }Edited by: NewJavaKid on Apr 29, 2009 10:47 PM

    If you use an enum construct, then you can create a switch that operates on the abbreviated month value. Note that I made a correction in the Scanner input code, and converted the input to lowercase (to assure a match with the enum) in case capitals were used. The switch was revised to work correctly with enums, which requires the try/catch to catch illegal input.
    import java.util.Scanner;
    public class Xy
        static Scanner console = new Scanner(System.in);
        enum Month
            jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
        public static void main(String[] args)
            System.out.print("Enter a Month: ex. Jan, Feb, Mar etc...");
            String shortMonth = console.next().toLowerCase();
            System.out.println();
            try
                switch (Month.valueOf(shortMonth))
                    case jan:
                    case feb:
                    case mar:
                        System.out.println("First Quarter");
                        break;
                    case apr:
                    case may:
                    case jun:
                        System.out.println("Second  Quarter");
                        break;
                    case jul:
                    case aug:
                    case sep:
                        System.out.println("Third Quarter");
                        break;
                    case oct:
                    case nov:
                    case dec:
                        System.out.println("Fouth Quarter");
            catch (IllegalArgumentException iae)
                System.out.println("Sorry, input is invalid");
    }

  • Help with String/ and or Array loading and comparing

    Hi all,
    I'm having some problems with trying to find the best way to achieve the following on a Poker Dealing program. I randomly shuffle a 52 card deck of playing cards and deal out 5 cards. Cool...
    Now I have to go back thru the String and determine if my hand of cards contains
    a pair
    2 pair
    3 of a kind
    Full House
    etc etc
    I am trying to do String comparisons (there is an empty compareCards method in my code right now, but I'm getting a bit frustrated as to find the best way to do it... Would an array load in a separate method be a better way???? What I need to do is after I load my hand , is to display a message stating a pair, 3 of a kind , etc etc.....
    Thanks in advance
    Mike
    Here is my code (please don't laugh too hard - I'm an old COBOL/Oracle guy):
    // Card shuffling and dealing program
    // Java core packages
    import java.awt.*;
    import java.awt.event.*;
    // Java extension packages
    import javax.swing.*;
    public class DeckOfCards extends JFrame {
    private Card deck[];
    private Card hand[];
    private int currentCard;
    private JButton dealButton, shuffleButton;
    private JTextArea outputArea ;
    private JTextField displayField;
    private JLabel statusLabel;
    // set up deck of cards and GUI
    public DeckOfCards()
    super( "Poker Game" );
    String faces[] = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };
    String suits[] = { "Hearts", "Diamonds", "Clubs", "Spades" };
    String display = "" ;
    deck = new Card[ 52 ];
    currentCard = -1;
    // populate deck with Card objects
    for ( int count = 0; count < deck.length; count++ )
    deck[ count ] = new Card( faces[ count % 13 ],
    suits[ count / 13 ] );
    // set up GUI and event handling
    Container container = getContentPane();
    container.setLayout( new FlowLayout() );
    // shuffle button
    shuffleButton = new JButton( "Shuffle cards" );
    shuffleButton.addActionListener(
    // anonymous inner class
    new ActionListener() {
    // shuffle deck
    public void actionPerformed( ActionEvent actionEvent )
    displayField.setText( "" );
    shuffle();
    displayField.setText( "The Deck is Shuffled" );
    statusLabel.setText( "" );
    } // end anonymous inner class
    ); // end call to addActionListener
    container.add( shuffleButton );
    // Deal button
    dealButton = new JButton( "Deal Hand" );
    dealButton.addActionListener (
    // anonymous inner class
    new ActionListener() {
    // deal 5 cards
    public void actionPerformed( ActionEvent actionEvent )
    outputArea.setText( "" ) ;
    displayField.setText( "" );
    for ( int cctr = 1 ; cctr <= 5; cctr++ ){     
    Card dealt = dealCard();
    if ( dealt != null ) {
    outputArea.append( dealt.toString()+"\n" );
    else {
    displayField.setText( "No more cards left" );
    statusLabel.setText( "Shuffle cards to continue" );}
    } // end for structure
    compareCards() ;
    } // end action
    } // end anonymous inner class
    ); // end call to addActionListener
    container.add( dealButton );
    outputArea = new JTextArea (10, 20) ;
    outputArea.setEditable( false ) ;
    container.add( outputArea ) ;
    displayField = new JTextField( 20 );
    displayField.setEditable( false );
    container.add( displayField );
    statusLabel = new JLabel();
    container.add( statusLabel );
    setSize( 275, 275 ); // set window size
    show(); // show window
    // shuffle deck of cards with one-pass algorithm
    public void shuffle()
    currentCard = -1;
    // for each card, pick another random card and swap them
    for ( int first = 0; first < deck.length; first++ ) {
    int second = ( int ) ( Math.random() * 52 );
    Card temp = deck[ first ];
    deck[ first ] = deck[ second ];
    deck[ second ] = temp;
    dealButton.setEnabled( true );
    public void compareCards()
    public Card dealCard()
    if ( ++currentCard < deck.length )
    return deck[ currentCard ];
    else {       
    dealButton.setEnabled( false );
    return null;
    // execute application
    public static void main( String args[] )
    DeckOfCards app = new DeckOfCards();
    app.addWindowListener(
    // anonymous inner class
    new WindowAdapter() {
    // terminate application when user closes window
    public void windowClosing( WindowEvent windowEvent )
    System.exit( 0 );
    } // end anonymous inner class
    ); // end call to addWindowListener
    } // end method main
    } // end class DeckOfCards
    // class to represent a card
    class Card {
    private String face;
    private String suit;
    // constructor to initialize a card
    public Card( String cardFace, String cardSuit )
    face = cardFace;
    suit = cardSuit;
    // return String represenation of Card
    public String toString()
    return face + " of " + suit;
    } // end class Card

    You could have the original face values as integers, thus Ace = 1, Jack = 11 (it'll be easy enough to display the proper values AJQK if you keep your string array and just display whatever corresponds to the value held in your int array).
    Each player gets an array of five cards. You could the loop through each hand and increment values held in another array by one according to the value of the card. Haven't coded the following up but it should work I think.
    // hand [ ] represents the cards held by that player
    int handChecker [ ] = new int [14]
    for (int counter = 0; counter < 5; ++ counter)
    // 1st card is an Ace. handChecker [1] will be incrementd by one and so on
    // 2nd card is a 9. handChecker[9] will be incremented by one.
    handChecker[hand[counter]] += 1;
    // Loop through the array handChecker to find pairs etc.
    boolean pair = false;
    bollean tofk = false;
    for (int counter = 1; counter < 14; ++ counter)
    if (handChecker[counter] == 2)
    pair = true;
    if (handChecker[counter] == 3)
    tofk = true;
    if (pair)
    // player has a pair
    if(tofk)
    // player has three of a kind
    if(pair && tofk)
    // player has a full house

  • Help with string.valueof

    I have the following code which is meant to read in a file into text boxes and let me scroll through all the items in the file.
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import bank.*;
    public class ReadSequentialFile extends JFrame {
       private ObjectInputStream input;
       private BankUI userInterface;
       private JButton nextButton, openButton, nextRecordButton ;
       private Store store = new Store(50);
         private Employee employeeList[] = new Employee[50];
         private int count = 0, next = 0;
       // Constructor -- initialize the Frame
       public ReadSequentialFile()
          super( "View Data" );
          // create instance of reusable user interface
          userInterface = new BankUI( 8 );  // eight textfields
          getContentPane().add( userInterface, BorderLayout.CENTER );
          // get reference to generic task button doTask1 from BankUI
          openButton = userInterface.getDoTask1Button();
          openButton.setText( "Open File" );
          // register listener to call openFile when button pressed
          openButton.addActionListener(
             // anonymous inner class to handle openButton event
             new ActionListener() {
                // close file and terminate application
                public void actionPerformed( ActionEvent event )
                   openFile();
             } // end anonymous inner class
          ); // end call to addActionListener
          // register window listener for window closing event
          addWindowListener(
             // anonymous inner class to handle windowClosing event
             new WindowAdapter() {
                // close file and terminate application
                public void windowClosing( WindowEvent event )
                   if ( input != null )
                             closeFile();
                   System.exit( 0 );
             } // end anonymous inner class
          ); // end call to addWindowListener
          // get reference to generic task button doTask2 from BankUI
          nextButton = userInterface.getDoTask2Button();
          nextButton.setText( "Next Record" );
          nextButton.setEnabled( false );
          // register listener to call readRecord when button pressed
          nextButton.addActionListener(
             // anonymous inner class to handle nextRecord event
             new ActionListener() {
                // call readRecord when user clicks nextRecord
                public void actionPerformed( ActionEvent event )
                   readRecord();
             } // end anonymous inner class
          ); // end call to addActionListener
          nextRecordButton = userInterface.getDoTask3Button();
          nextRecordButton.setText( "Get Next Record" );
          nextRecordButton.setEnabled( false );
          // register listener to call readRecord when button pressed
          nextRecordButton.addActionListener(
             // anonymous inner class to handle nextRecord event
             new ActionListener() {
                // call readRecord when user clicks nextRecord
                public void actionPerformed( ActionEvent event )
                   getNextRecord();
             } // end anonymous inner class
          ); // end call to addActionListener
          pack();
          setSize( 600, 300 );
          setVisible( true );
       } // end ReadSequentialFile constructor
       // enable user to select file to open
       private void openFile()
          // display file dialog so user can select file to open
          JFileChooser fileChooser = new JFileChooser();
          fileChooser.setFileSelectionMode( JFileChooser.FILES_ONLY );
          int result = fileChooser.showOpenDialog( this );
          // if user clicked Cancel button on dialog, return
          if ( result == JFileChooser.CANCEL_OPTION )
             return;
          // obtain selected file
          File fileName = fileChooser.getSelectedFile();
          // display error if file name invalid
          if ( fileName == null || fileName.getName().equals( "" ) )
             JOptionPane.showMessageDialog( this, "Invalid File Name",
                "Invalid File Name!", JOptionPane.ERROR_MESSAGE );
          else {
             // open file
             try {
                input = new ObjectInputStream(
                   new FileInputStream( fileName ) );
                openButton.setEnabled( false );
                nextButton.setEnabled( true );
             // process exceptions opening file
             catch ( IOException ioException ) {
                JOptionPane.showMessageDialog( this, "Error Opening File",
                   "Error", JOptionPane.ERROR_MESSAGE );
          } // end else
       } // end method openFile
       // read record from file
       public void readRecord()
          Employee record;
          // input the values from the file
          try {
            record = ( Employee ) input.readObject();
         employeeList[count++]= record;
         store.add(record);
              store.displayAll(); // displays store in terminal window
              System.out.println("Count is " + store.getCount());
             // create array of Strings to display in GUI
             String values[] = { String.valueOf(record.getName()),
             String.valueOf(record.getGender()),
              String.valueOf( record.getStartDate() ),
             String.valueOf( record.getID() ),
               String.valueOf( record.getDateOfBirth() ) };
             // display record contents
             userInterface.setFieldValues( values );
          // display message when end-of-file reached
          catch ( EOFException endOfFileException ) {
             nextButton.setEnabled( false );
          nextRecordButton.setEnabled( true );
             JOptionPane.showMessageDialog( this, "No more records in file",
                "End of File", JOptionPane.ERROR_MESSAGE );
          // display error message if class is not found
          catch ( ClassNotFoundException classNotFoundException ) {
             JOptionPane.showMessageDialog( this, "Unable to create object",
                "Class Not Found", JOptionPane.ERROR_MESSAGE );
          // display error message if cannot read due to problem with file
          catch ( IOException ioException ) {
             JOptionPane.showMessageDialog( this,
                "Error during read from file",
                "Read Error", JOptionPane.ERROR_MESSAGE );
       } // end method readRecord
       private void getNextRecord()
               Employee record = employeeList[next++%count];//cycles throught accounts
          //create aray of string to display in GUI
          String values[] = {String.valueOf(record.getName()),
             String.valueOf(record.getGender()),
              String.valueOf( record.getStartDate() ),
             String.valueOf( record.getID() ),
               String.valueOf( record.getDateOfBirth() ) };
      // close file and terminate application
       private void closeFile()
          // close file and exit
          try {
             input.close();
             System.exit( 0 );
          // process exception while closing file
          catch ( IOException ioException ) {
             JOptionPane.showMessageDialog( this, "Error closing file",
                "Error", JOptionPane.ERROR_MESSAGE );
             System.exit( 1 );
       } // end method closeFile
       public static void main( String args[] )
          new ReadSequentialFile();
    } // end class ReadSequentialFileMy problem is when i compile the code i get the following errors:
    ReadSequentialFile.java:181: getStartDate(Date) in Employee cannot be applied to
              String.valueOf( record.getStartDate() ),
                                    ^In the employee class I did getStartDate like:
         public Date getStartDate(Date sDate)
              return start;
         }Can anybody tell me why i get this error and how to solve it?

    so in
    the employee class i need to chnage the getDate
    method?Well, it's your class, so it's up to you to know what that method is supposed to do, to give it a signature that allows it to be called with the data to do its job, and the pass it the right data when you call it.
    Don't think only about how to make the compiler happy. Think about what you're trying to accomplish and in what way the current code doesn't do that. The compiler can only really detect syntactical errors, but sometimes those errors arise as the result of logic errors in your mental picture of the steps to follow. So take the compiler's complaints as a hint to reexamine what you're doing and see if it makes sense.

  • Need Help with XML Parsing on to DataGrid

    Hi
    I have retrivied  this  Data  into my HttpService Result function .
    <list>
      <User>
        <ename>JAMES</ename>
        <empno>7900</empno>
      </User>
      <User>
        <ename>FORD</ename>
        <empno>7902</empno>
      </User>
      <User>
        <ename>MILLER</ename>
        <empno>7934</empno>
      </User>
    </list>
    [Bindable]
        private var xmldata:XML;
    private function resultHandler(event:ResultEvent):void{
            xmldata=event.result as XML;
    <mx:DataGrid x="50" y="23" width="469" height="265" dataProvider="{xmldata.User}">
      <mx:columns>
       <mx:DataGridColumn headerText="Type" dataField="ename"/>
       <mx:DataGridColumn headerText="Sales" dataField="empno"/>
      </mx:columns>
    </mx:DataGrid>
    But this is not displaying any data into DataGrid .
    Could anybody please help me .
    Thanks .

    after you get data assign the data to the data grid
    datagrid.dataprovider = xml;
    and also do datagrid.invalidateList() after u get the data if the above line does not help
    also see if the data provider is not null if nothing helped.

Maybe you are looking for

  • Changing content in an array

    can someone help me with changing content in an array. The index will be specified by the user entering the index number. eg Enter the item number to Change 1 Then I need to replace the data in this index with new data. I am very new to java so I am

  • Read only error message when trying to save updates in Acrobat 10.6.3

    Hello Hopefully I'm missing something obvious here but when I try to edit a PDF in Acrobat 10.6.3 I receive a read only error message, I have been using 'Save As' and tweaking the name each time but this seems to be a clumsy way to go about a simple

  • Issue related to excise invoice

    Dear All, How return order is adjusted towards excise invoice. Example: Sales> Delivery> Billing-->Excise Invoice. ( Here excixe invoice is paid t-code J1IIN) Return Order > Return Delivery> Billing ( How excise invoice is done here) My question is D

  • Refresh customization screen in module pool programming

    Hello Colleagues, I have a requirement where in i have to refresh the customization screen of table. Detail: i have generated table maintenance screen of  table 'XYZ'.  Now from this screen i am launching one pop-up screen. within this pop-up screen

  • CS6 Clone stamp problem

    I'm trying to cover up some blown out flash reflections using the clone stamp (100% opacity) on a JPG image. However, I'm only getting an ugly brown spot where the reflection is, instead of covered up pixels. What am I doing wrong?