Help: I am trying to pass a variable between classes

I am trying to pass data in a variable inbetween two classes is there any suggestions as to how to do this? Here is a example of the code I am trying to pass MqMessage to the class MqLog.
if(MqMessage.equals("END"))               
                                   finalize();
                                   System.exit( 0 );
                         else //else build flat file and launch docusolve
                                   MqLog tempMqLog = new MqLog();
                                   tempMqLog.levelThreeDiagnostic();
                                   aRuntime = null;
                                   aProcess = null;                                   
                              }

I don't really undestand what you are asking specifically. If you only want to transfer a value from one Object to another Object, then you should just use a set method:
if (objectOne.getValue().equals("END"))
end();
else
objectTwo.setValue(objectOne.getValue())

Similar Messages

  • Please help!! Can I pass a variable between 2 swf's that are on different html pages?

    Hey,
    Does anyone know how to pass a variable (string) from one swf
    to another if there in separate html pages?
    I assume I’d have to send the variable from the first
    page and load it into the second but I don’t know what
    functions or code I should be using. Any suggestions would be a
    HUGE help.
    Thanks
    If it helps: I’m creating a log in and sign up sheet
    that can be accessed from several sites. I’d like to record
    which site the user has come from when they signup.
    Thanks

    if they are open at the same time (for the same user), you
    can use the localconnection class to communicate between the
    two.

  • Passing a variable between functions [Silly Question]

    Hey, I am trying to write a program (who wouldve guessed) and I have the following problem. I set a variable in one function, but when I access it from another one, it is "undefined". How can I pass the variable, so both the functions see it? I thought the "public" class when defining a function should take care of that, but I was obviously wrong. Please help? (Code following...)
    public function dalsi_slovicko():void {
                   var pocet_slovicek = slovnikXML.slovicka.elements("*").length();
                   var cislo_slovicka = randomNumber(0, pocet_slovicek);
                   var slovicko_1 = ask(cislo_slovicka, "en");
                   var slovicko_2 = ask(cislo_slovicka, "cs");
                   slovicko1.text = slovicko_1;
    private function kontrola() : void {
              if (nazor.text == slovicko_2) {
                    dalsi_slovicko()
              else {
                   Alert.show("Špatně!! \n Slovicko_2 bylo:" + slovicko_2);
    Thanks...

    create the variable outside the functions so it is accessible for all the functions.
    private var slovicko_2;
    public function dalsi_slovicko():void {
                var pocet_slovicek = slovnikXML.slovicka.elements("*").length();
                 var cislo_slovicka = randomNumber(0, pocet_slovicek);
                 var slovicko_1 = ask(cislo_slovicka, "en");
                 slovicko_2 = ask(cislo_slovicka, "cs");
                 slovicko1.text = slovicko_1;
    private function kontrola() : void {
              if (nazor.text == slovicko_2) {
                   dalsi_slovicko()
              else {
                  Alert.show("Špatně!! \n Slovicko_2 bylo:" + slovicko_2);
    Also when you declare variables, set  appropriate datatypes

  • How can I pass a variable between JSP and Role Form

    I need to pass a variable from (a copy of) applicationmodify.jsp to the IDM Role Form so that the variable is available within the Role Form at display. We've tried getAttribute and setAttribute modifying both the Role Form and the applicationmodify JSP and can get the form to the role form but not accessible but have had no other success. Has anyone had any success in doing this? Any suggestions would be appreciated.

    if by _root level you mean you're loading something into
    _level0 you can't won't be able to use the localconnection. the
    sharedobject is your only option.

  • Passing a variable between applications

    Hi,
    I would like to pass a variable from a jsp page in a portal application into KM repository filter with user session context. For example, I will set { var1="sample data" } in the portal application and read it in the repository filter. Actually I am looking for a model like import/export statement in ABAP.
    Thank you,
    Orkun

    Hi Orkun
    Considering you aren't trying to send the variable in your url, you must concatenate your variable inside your well formed url and it must be considered during the iView configuration in your portal.
    KM is able to get all posts from the client once you have informed first the name of variable that  you are posting in your form.
    There's no need to use session context at this point, we must consider session contexts when talking about statefull session beans.

  • Passing an variable through classes on init

    i have a main class
    this class starts up another class
    so iv got 3 classes
    class1
    -load class2
    class2
    -load class3
    class3
    maxslots = 0
    now that maxslots variable i want to set up from the VERY first class1
    but i cant see how you pass it thought the classes so its loaded when each class is started up
    class class1{
         private static      class2 class2x= null;
      public static void main(String[] args) throws IOException {
              class2x= new class2(7);
    }ok so my class 2 now has 7
    public class class2 implements Runnable {
            int maxSlots = 0;
            static class3 class3x= new class3(maxSlots);
         public class2(int maxSlotsx) {
              maxSlots = maxSlotsx
    public class class3{
            int maxSlots = 0;
         public class3(int maxSlotsx) {
                    maxSlots = maxSlotsx
              System.out.println("maxSlots"+maxSlots);
    }now in class 2 i CANT place the set up class3 thing within class2 constructor because its runnable and only want it done ONCE
    any idea how to pass var 7 down to my end class3
    thanks :)

    ah i worked it out lol

  • CRM_IC: Passing Attribute values between classes

    Hi,
    I'm working on CRM_IC Inbox Enhancements module and facing a problem passing values from one class to another.
    Can any one let me know how can i access the value of an attribute declared and changed in one class can be used and accessed in another class.
    Thanks in advance
    Ajay Yeluguri

    Hi Thirumala,
    Thanks for the answer.
    I'm new to this CRM development and trying what you said but getting errors when executed
    Please check the code and let me know if any changes
    <b>In the first class:</b>
      DATA: lr_bdc TYPE REF TO cl_crm_ic_cucobdc_impl.
       lr_bdc ?= lr_bdc->get_custom_controller( 'CuCoBDC' ).
       lr_bdc->set_navigation_data(
                    iv_source_view_name  = 'testdata' ).
    <b>In the next class:</b>
    DATA: lr_bdc             TYPE REF TO cl_crm_ic_cucobdc_impl,
          lv_bp_number       TYPE string,
          lr_selected_object TYPE REF TO if_bol_bo_property_access.
      lr_bdc ?= lr_bdc->get_custom_controller( 'CuCoBDC' ).
        CALL METHOD lr_bdc->get_navigation_data
          IMPORTING
            ev_selected_object = lr_selected_object.
    Thanks
    Ajay

  • How share variables between classes ???

    Hi !
    Basically I have two classes and I would like them to share a variable, I mean, when I modify it on one class the other one is also affected.
    how can I do that ? by using the inheritance principle or is it a simple way so that we don't have one more class??
    thank you a lot for your answer !
    PA

    If you want them to always have the same value, you should have only one variable:public class ClassOne
      private static int theVar = 0;
      public static void setTheVar(int value){theVar = value;}
      public static int getTheVar(){return theVar;}
    public class ClassTwo
      public static int getTheVar(){return ClassOne.getTheVar();}
    }

  • HELP ME i need to pass String variables from one Frame to another

    I need help with some code.
    i need to pass a set of string values from one frame to another.
    from the mainscreen i need to pass what type of seats the user has requested this is done by radio buttons. i need this information to then be passed onto the next frame called Mydialog1 and placed in a textbox with label st. it dosn't comple and i don't know why
    this is getting me depressed. I need some serious help with this
    can anybody get this to work??
    here is the code
    Mainscreen1 code
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class mainscreen1 extends Applet implements ItemListener,
    ActionListener
    private Image layout1;
    private int frame;
    private int xpos,ypos,xdir,ydir;
    public TextField tn, tt1, tt2, total;
    public int value, ticketnum, sum, nr_seats, ctot;
    public Label title, seat, need, payable;
    public Button b1, b2, b3;
    Mydialog1 d;
    String stype, c1, sr;
    public void init()
         setBackground(Color.pink);
    setSize (600, 460);
    setLayout(null);
    //Mydialog1.mehod(sr);
    title=new Label("The Almeida Theater booking system");
         title.setBounds(100,0,400,30);
         title.setFont(new Font("Verdana", Font.PLAIN,24));
         add(title);
    seat=new Label("Please choose a seating location:");
         seat.setBounds(300,40,190,20);
         seat.setFont(new Font("Verdana", Font.BOLD,12));
         add(seat);
    payable=new Label("Total Payable:�");
         payable.setBounds(300,390,100,20);
         payable.setFont(new Font("Verdana", Font.BOLD,12));
         add(payable);
         need=new Label("Please enter the number of seats needed:");
         need.setBounds(300,180,245,20);
         need.setFont(new Font("Verdana", Font.BOLD,12));
         add(need);
         CheckboxGroup sr = new CheckboxGroup();
         Checkbox Stalls = new Checkbox("Stalls", true, sr);
         Stalls.setBounds(490,40,60,25);
         add(Stalls);
         Stalls.addItemListener(this);
         Checkbox Balcony = new Checkbox("Balcony", false, sr);
         Balcony.setBounds(490,65,65,25);
         add(Balcony);
         Balcony.addItemListener(this);
         Checkbox Concessions = new Checkbox("Concessions", false,
    sr);
         Concessions.setBounds(490,90,94,25);
         add(Concessions);
         Concessions.addItemListener(this);
    Button b1=new Button("Quote");
         b1.setBounds(20,395,80,30);
         add(b1);
         b1.addActionListener( this );
         Button b2=new Button("Confirm booking");
         b2.setBounds(110,395,100,30);
         add(b2);
         b2.addActionListener( this );
         Button b3=new Button("Clear");
         b3.setBounds(480,410,100,30);
         add(b3);
         b3.addActionListener( this );
         tt1=new TextField(60);
         tt1.setBounds(300,250,270,20);
    add(tt1);
         tt1.setEditable (false);
         tt1.addActionListener(this);
         tt2=new TextField(60);
         tt2.setBounds(300,300,150,20);
         add(tt2);
         tt2.setEditable (false);
         tt2.addActionListener(this);
         tn=new TextField(3);
         tn.setBounds(545,180,30,20);
         add(tn);
         tn.addActionListener(this);
         total=new TextField(5);
         total.setBounds(400,390,45,20);
         add(total);
         total.setEditable (false);
         total.addActionListener(this);
         xpos = getSize().width/-1400;
         ypos = getSize().height/12;
         layout1 = getImage(getDocumentBase(),"layout1.gif");
         repaint();
    public void itemStateChanged(ItemEvent e)
         String c1 = (String) e.getItem();
         if (c1 == "Stalls")
              value = 20;
         else if (c1 == "Balcony")
              value = 15;
         else
              value = 10;
         tt1.setText("You have chosen to sit in the " + c1 + "
    area");
         tt2.setText("Each seat will cost: �" + value);
         repaint();
    public void clearValue()
              //cb.setSelectiob
              total.setText("");
              tt1.setText("");
              tt2.setText("");
              tn.setText("");
    public void actionPerformed ( ActionEvent e )
    if( e.getActionCommand() == "Quote" )
         int nr_seats = Integer.parseInt(tn.getText());
         total.setText("" +nr_seats*value);
    else if( e.getActionCommand() == "Confirm booking")
         int nr_seats = Integer.parseInt(tn.getText());
         int ctot = Integer.parseInt(total.getText());
         //String stype = String.parseString(c1.getText());
         total.setText("" +nr_seats*value);   
         d = new Mydialog1();      
         d.set_text(nr_seats);
         d.set_texts(ctot);
         stype = sr.getSelectedItem();
    else if ( e.getActionCommand() == "Clear")
         clearValue();
              ticketnum = Integer.parseInt(tn.getText());
              repaint();
         public void paint(Graphics g)
              g.setColor(Color.black);
              g.drawString ("You have chosen:" + ticketnum +"
    seats", 300, 365);
              g.drawImage(layout1,xpos,ypos,null);
    Mydialog1 code
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Mydialog1 extends Frame implements ItemListener,
    ActionListener
    public Label title, custd, custd1, custfn, custad, custsn, custpc,
    custph, custem, custem1, need;
    public Button b1, b2, b3;
    public TextField cfnt, csnt, cdt,cdt2,cdt3,cdt4, tf, tt, st,
    cpct, cph, cem;
    public int value, nr_seats, ctot;
    creditcard cc;
    String stype, c;
    public Mydialog1() //constructor
         init();
    public void init()
         custer(String c)
         stype = c;
         setBackground(Color.yellow);
    setSize (500, 500);
    setLayout(null);
         setLocation(320,140);
         setVisible(true);
         //Mydialog1(Frame f);
    title=new Label("The Almeida Theater booking system");
         title.setBounds(70,20,400,30);
         title.setFont(new Font("Verdana", Font.PLAIN,24));
         add(title);
         CheckboxGroup ct = new CheckboxGroup();
         Checkbox Mr = new Checkbox("Mr", true, ct);
         Mr.setBounds(5,190,36,25);
         add(Mr);
         Mr.addItemListener(this);
         Checkbox Mrs = new Checkbox("Mrs", false, ct);
         Mrs.setBounds(50,190,42,25);
         add(Mrs);
         Mrs.addItemListener(this);
         Checkbox Miss = new Checkbox("Miss", false, ct);
         Miss.setBounds(95,190,45,25);
         add(Miss);
         Miss.addItemListener(this);
    custd=new Label("If above booking details are correct please
    fill in your deatils below");
         custd.setBounds(5,140,400,30);
         add(custd);
         custd1=new Label("If they are incorrect please click on
    close and re-book seats.");
         custd1.setBounds(5,160,400,30);
         add(custd1);
         custfn=new Label("*ForeName:");
         custfn.setBounds(5,220,60,20);
         add(custfn);
         cfnt=new TextField(60);
         cfnt.setBounds(70,220,150,20);
    add(cfnt);
         custsn=new Label("*SurName:");
         custsn.setBounds(230,220,60,20);
         add(custsn);
         csnt=new TextField(60);
         csnt.setBounds(300,220,150,20);
    add(csnt);
         custad=new Label("*Address:");
         custad.setBounds(5,250,55,20);
         add(custad);
         cdt=new TextField(60);
         cdt.setBounds(70,250,180,20);
    add(cdt);
         cdt2=new TextField(60);
         cdt2.setBounds(70,270,180,20);
    add(cdt2);
         cdt3=new TextField(60);
         cdt3.setBounds(70,290,180,20);
    add(cdt3);
         cdt4=new TextField(60);
         cdt4.setBounds(70,310,180,20);
    add(cdt4);
         custpc=new Label("*Postcode:");
         custpc.setBounds(5,330,60,20);
         add(custpc);
         cpct=new TextField(60);
         cpct.setBounds(70,330,180,20);
    add(cpct);
         custph=new Label("*Telephone:");
         custph.setBounds(5,360,65,20);
         add(custph);
         cph=new TextField(60);
         cph.setBounds(70,360,180,20);
    add(cph);
         custem=new Label("E-mail:");
         custem.setBounds(5,390,65,20);
         add(custem);
         cem=new TextField(60);
         cem.setBounds(70,390,180,20);
    add(cem);
         custem1=new Label("eg: [email protected]");
         custem1.setBounds(250,390,150,20);
         add(custem);
         need=new Label("* = required field.");
         need.setBounds(350,400,150,20);
         add(need);
         //seat number being pased into this textbox
         tf = new TextField();
    tf.setBounds(5, 80, 160,20);
         tf.setEditable (false);
    add(tf);
         //seat number being pased into this textbox
         tt = new TextField();
    tt.setBounds(5, 100, 160,20);
         tt.setEditable (false);
    add(tt);
         //seat number being pased into this textbox
         st = new TextField(stype);
    st.setBounds(5, 120, 230,20);
         st.setEditable (false);
    add(st);
         setVisible(true);
         Button b1=new Button("Close");
         b1.setBounds(20,440,80,30);
         add(b1);
         b1.addActionListener( this );
         Button b2=new Button("Proced with booking");
         b2.setBounds(110,440,150,30);
         add(b2);
         b2.addActionListener( this );
         Button b3=new Button("Clear");
         b3.setBounds(350,440,100,30);
         add(b3);
         b3.addActionListener( this );
    public void itemStateChanged(ItemEvent e)
         String c2 = (String) e.getItem();
         if (c2 == "Mr")
              value = 20;
         else if (c2 == "Mrs")
              value = 15;
         else
              value = 10;
    public void clearValuea()
              //cb.setSelectiob
              cem.setText("");
              cph.setText("");
              cdt.setText("");
              cdt2.setText("");
              cdt3.setText("");
              cdt4.setText("");
              cfnt.setText("");
              csnt.setText("");
              cpct.setText("");
              cph.setText("");
              cem.setText("");
    public void actionPerformed( ActionEvent e )
    if( e.getActionCommand() == "Close" )
    this.dispose();
    else if( e.getActionCommand() == "Proced with booking")
    cc = new creditcard();
    else if( e.getActionCommand() == "Clear")
    clearValuea();
         public void set_text (int nr_seats)
         tf.setText (" You have booked " + nr_seats + " seat/s");
         public void set_texts (int ctot)
         tt.setText (" The total is � " + ctot);
         public void SetTextField(String c1)
         st.setText(c1);
    creditcard
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class creditcard extends Frame implements ActionListener
         public Label title, ccd1, ccfn;
         public Button b1, b2;
         public TextField cnt, cdt, ccfnt;
         public String cfnt;
    public creditcard() //constructor
         init();
    public void init()
         setBackground(Color.green);
    setSize (500, 500);
    setLayout(null);
         setLocation(320,140);
         setVisible(true);
         //Mydialog1(Frame f);
    title=new Label("The Almeida Theater booking system");
         title.setBounds(70,20,400,30);
         title.setFont(new Font("Verdana", Font.PLAIN,24));
         add(title);
         ccd1=new Label("If billing address is different please edit below information.");
         ccd1.setBounds(5,50,400,20);
         ccd1.setFont(new Font("Verdana", Font.BOLD,12));
         add(ccd1);
         ccfn=new Label("*ForeName:");
         ccfn.setBounds(5,220,60,20);
         add(ccfn);
         ccfnt=new TextField(60);
         ccfnt.setBounds(70,220,150,20);
    add(ccfnt);
         Button b1=new Button("Close");
         b1.setBounds(20,440,80,30);
         add(b1);
         b1.addActionListener( this );
         Button b2=new Button("Proced with booking");
         b2.setBounds(110,440,150,30);
         add(b2);
         b2.addActionListener( this );
    public void actionPerformed( ActionEvent e )
    if( e.getActionCommand() == "Close" )
    this.dispose();
    else if( e.getActionCommand() == "Proced with booking")
    setBackground(Color.red);

    Here's the new mainscreen1.java file...
    public class mainscreen1 extends Applet implements ItemListener,
    ActionListener
      private Image layout1;
      private int frame;
      private int xpos,ypos,xdir,ydir;
      public TextField tn, tt1, tt2, total;
      public int value, ticketnum, sum, nr_seats, ctot;
      public Label title, seat, need, payable;
      public Button b1, b2, b3;
      Mydialog1 d;
      CheckboxGroup checkGroup; // heres the new global CheckboxGroup variable.
      String stype, c1, dialogString; // new name for the string too...
      public void init()
        setBackground(Color.pink);
        setSize(600, 460);
        setLayout(null);
        //dialogString = "Hi";
        //Mydialog1.mehod(dialogString);
        title=new Label("The Almeida Theater booking system");
        title.setBounds(100,0,400,30);
        title.setFont(new Font("Verdana", Font.PLAIN,24));
        add(title);
        seat=new Label("Please choose a seating location:");
        seat.setBounds(300,40,190,20);
        seat.setFont(new Font("Verdana", Font.BOLD,12));
        add(seat);
        payable=new Label("Total Payable:�");
        payable.setBounds(300,390,100,20);
        payable.setFont(new Font("Verdana", Font.BOLD,12));
        add(payable);
        need=new Label("Please enter the number of seats needed:");
        need.setBounds(300,180,245,20);
        need.setFont(new Font("Verdana", Font.BOLD,12));
        add(need);
        checkGroup = new CheckboxGroup(); // instantiate the global CheckboxGroup
        Checkbox Stalls = new Checkbox("Stalls", true, checkGroup); // add to the CheckboxGroup
        Stalls.setBounds(490,40,60,25);
        add(Stalls);
        Stalls.addItemListener(this);
        Checkbox Balcony = new Checkbox("Balcony", false, checkGroup);
        Balcony.setBounds(490,65,65,25);
        add(Balcony);
        Balcony.addItemListener(this);
        Checkbox Concessions = new Checkbox("Concessions", false, checkGroup);
        Concessions.setBounds(490,90,94,25);
        add(Concessions);
        Concessions.addItemListener(this);
        Button b1=new Button("Quote");
        b1.setBounds(20,395,80,30);
        add(b1);
        b1.addActionListener( this );
        Button b2=new Button("Confirm booking");
        b2.setBounds(110,395,100,30);
        add(b2);
        b2.addActionListener( this );
        Button b3=new Button("Clear");
        b3.setBounds(480,410,100,30);
        add(b3);
        b3.addActionListener( this );
        tt1=new TextField(60);
        tt1.setBounds(300,250,270,20);
        add(tt1);
        tt1.setEditable(false);
        tt1.addActionListener(this);
        tt2=new TextField(60);
        tt2.setBounds(300,300,150,20);
        add(tt2);
        tt2.setEditable(false);
        tt2.addActionListener(this);
        tn=new TextField(3);
        tn.setBounds(545,180,30,20);
        add(tn);
        tn.addActionListener(this);
        total=new TextField(5);
        total.setBounds(400,390,45,20);
        add(total);
        total.setEditable(false);
        total.addActionListener(this);
        xpos = getSize().width/-1400;
        ypos = getSize().height/12;
        layout1 = getImage(getDocumentBase(),"layout1.gif");
        repaint();
      public void itemStateChanged(ItemEvent e) {
        String c1 = (String) e.getItem();
        if (c1 == "Stalls") {
          value = 20;
        else if (c1 == "Balcony") {
          value = 15;
        else {
          value = 10;
        tt1.setText("You have chosen to sit in the " + c1 + " area");
        tt2.setText("Each seat will cost: �" + value);
        repaint();
      public void clearValue() {
        //cb.setSelectiob
        total.setText("");
        tt1.setText("");
        tt2.setText("");
        tn.setText("");
      public void actionPerformed( ActionEvent e ) {
        if( e.getActionCommand() == "Quote" ) {
          int nr_seats = Integer.parseInt(tn.getText());
          total.setText("" +nr_seats*value);
        else if( e.getActionCommand() == "Confirm booking") {
          int nr_seats = Integer.parseInt(tn.getText());
          int ctot = Integer.parseInt(total.getText());
          total.setText("" +nr_seats*value);
          d = new Mydialog1();
          d.set_text(nr_seats);
          d.set_texts(ctot);
          // You can do your checkbox selection data transfer here like this...
          // I used d.SetTextField because you had that defined in the Mydialog1 class.
          Checkbox chkBx = checkGroup.getSelectedCheckbox();
          d.SetTextField(chkBx.getLabel());
        else if ( e.getActionCommand() == "Clear") {
          clearValue();
        ticketnum = Integer.parseInt(tn.getText());
        repaint();
      public void paint(Graphics g)
        g.setColor(Color.black);
        g.drawString("You have chosen:" + ticketnum +" seats", 300, 365);
        g.drawImage(layout1,xpos,ypos,null);
    }

  • Trying to pass a variable to fuzzy search

    I'm trying to write code like this:
       for x in 1 .. 6 loop
           v_searchword := listgetat(replace(p_searchphrase,',',' '),x,' ');
           for c1 in (select * from
                          (select score(1) as score, searchterms, suggestions from suggestions_table
                           where contains(searchterms,'fuzzy({'||v_searchword||'},,,weight)',1)>0
                           order by score desc)
                       where rownum < 10) loop                                    
            end loop;                  
       end loop;Someone passes in a long search phrase. I separate it into words and take up to the first 6. The set of words is looped through. Each word in turn is assigned to the v_searchword variable. I then do an Oracle Text fuzzy search on that word. The above code, however, gives me an Oracle Text parser error (DRG-50901: text query parser syntax error...).
    I've modified the code so that the all-important line reads *where contains(searchterms,'fuzzy({v_searchword},,,weight)',1)>0*, and whilst that doesn't produce a syntax error, it doesn't produce any results, either! Words that I know will generate suggestions when I do a manual fuzzy search in plain SQL (such as "womman" and "tomartoe") don't generate anything in this case, because (I think) instead of searching for 'womman' or 'tomartoe' it's actually just searching for the word 'v_searchword' each time.
    Could someone tell me how to write my code so that the correct word is passed into the contains function each time, please? It seems syntactically not very difficult, but I'm stumped!

    If any value for v_searchword is null it would result in an invalid syntax, searching for {}. This would happen if there was no such element, such as no sixth word in a string of five words. You might also want to remove duplciate spaces from the string. Please see the demonstration below that first reproduces, then corrects the error simply by adding a condition that v_searchword is not null.
    SCOTT@orcl_11g> create table suggestions_table
      2    (searchterms  varchar2 (30),
      3       suggestions  varchar2 (20))
      4  /
    Table created.
    SCOTT@orcl_11g> insert all
      2  into suggestions_table values ('woman', null)
      3  into suggestions_table values ('women', null)
      4  into suggestions_table values ('tomato', null)
      5  into suggestions_table values ('tomatoes', null)
      6  select * from dual
      7  /
    4 rows created.
    SCOTT@orcl_11g> create index your_index
      2  on suggestions_table (searchterms)
      3  indextype is ctxsys.context
      4  /
    Index created.
    SCOTT@orcl_11g> CREATE OR REPLACE FUNCTION listgetat
      2       (p_string    VARCHAR2,
      3        p_element   INTEGER,
      4        p_separator VARCHAR2 DEFAULT ' ')
      5       RETURN          VARCHAR2
      6  AS
      7    v_string      VARCHAR2 (32767);
      8  BEGIN
      9    -- ensure there are starting and ending separators:
    10    v_string := p_separator || p_string || p_separator;
    11    -- remove all double separators:
    12    WHILE INSTR (v_string, p_separator || p_separator) > 0 LOOP
    13        v_string := REPLACE (v_string, p_separator || p_separator, p_separator);
    14    END LOOP;
    15    -- check if element exists:
    16    IF LENGTH (v_string) - LENGTH (REPLACE (v_string, p_separator, '')) >
    17         LENGTH (p_separator) * p_element
    18    THEN
    19        v_string := SUBSTR (v_string,
    20                      INSTR (v_string, p_separator, 1, p_element)
    21                      + LENGTH (p_separator));
    22        RETURN SUBSTR (v_string, 1, INSTR (v_string, p_separator) - 1);
    23    ELSE
    24        RETURN NULL;
    25    END IF;
    26  END listgetat;
    27  /
    Function created.
    SCOTT@orcl_11g> -- reproduction of error:
    SCOTT@orcl_11g> create or replace procedure test_proc
      2    (p_searchphrase     in varchar2)
      3  as
      4    v_searchword    varchar2 (100);
      5  begin
      6       for x in 1 .. 6 loop
      7           v_searchword := listgetat(replace(p_searchphrase,',',' '),x,' ');
      8 
      9           for c1 in (select * from
    10                    (select score(1) as score, searchterms, suggestions from suggestions_table
    11                     where contains(searchterms,'fuzzy({'||v_searchword||'},,,weight)',1)>0
    12                     order by score desc)
    13                 where rownum < 10) loop
    14              dbms_output.put_line
    15             (lpad (c1.score, 3) || ' ' ||
    16              rpad (c1.searchterms, 30) || ' ' ||
    17              v_searchword);
    18            end loop;
    19       end loop;
    20  end test_proc;
    21  /
    Procedure created.
    SCOTT@orcl_11g> show errors
    No errors.
    SCOTT@orcl_11g> exec test_proc ('womman,and,tomartoe')
    38 woman                          womman
    25 women                          womman
    29 tomato                         tomartoe
    26 tomatoes                       tomartoe
    BEGIN test_proc ('womman,and,tomartoe'); END;
    ERROR at line 1:
    ORA-29902: error in executing ODCIIndexStart() routine
    ORA-20000: Oracle Text error:
    DRG-50901: text query parser syntax error on line 1, column 8
    ORA-06512: at "SCOTT.TEST_PROC", line 9
    ORA-06512: at line 1
    SCOTT@orcl_11g> -- correction of error:
    SCOTT@orcl_11g> create or replace procedure test_proc
      2    (p_searchphrase     in varchar2)
      3  as
      4    v_searchword    varchar2 (100);
      5  begin
      6       for x in 1 .. 6 loop
      7           v_searchword := listgetat(replace(p_searchphrase,',',' '),x,' ');
      8           -- check if xth word exists:
      9           if v_searchword is not null then
    10             for c1 in (select * from
    11                      (select score(1) as score, searchterms, suggestions from suggestions_table
    12                       where contains(searchterms,'fuzzy({'||v_searchword||'},,,weight)',1)>0
    13                       order by score desc)
    14                   where rownum < 10) loop
    15             dbms_output.put_line
    16               (lpad (c1.score, 3) || ' ' ||
    17                rpad (c1.searchterms, 30) || ' ' ||
    18                v_searchword);
    19              end loop;
    20           end if;
    21       end loop;
    22  end test_proc;
    23  /
    Procedure created.
    SCOTT@orcl_11g> show errors
    No errors.
    SCOTT@orcl_11g> exec test_proc ('womman,and,tomartoe')
    38 woman                          womman
    25 women                          womman
    29 tomato                         tomartoe
    26 tomatoes                       tomartoe
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g>

  • How can i pass variables between classes?

    Hi.
    i have three classes and i need use a variable from 'Battleship' and use it in 'BattleWindow', these summaries of the classes, if anyone could give me a solution without editing it too much it would be greatly appreciated
    public class Ship{
    public Ship(){
    int missilesLeft;
    int shots = 10;
    for (int i=0;i<8;i++) {
         missilesLeft = shots - 1;
    //Panel
    public class PanelWindow{
         public static void main (String [] args) { 
         System.out.println(missilesLeft.Ship);
    Andrew

    i still can get it to work.. but i think that you got me quite close;
    this is where i need to get missilesLeft from
    //BattleShip
    public void mouseClicked(MouseEvent e){
         tries--;
         for (int i = 0; i < 8; i++){
          for (int j = 0; j < 8; j++){
           if (e.getSource().equals(buttons[i][j]) && ship[i][j] == true){
            buttons[i][j].setBackground(new Color(80,80,80));
            hit++;
            System.out.println(hit+" "+total);
           else if (e.getSource().equals(buttons[i][j]) && ship[i][j] == false){
            buttons[i][j].setBackground(new Color(0,0,255));
         //Win
          if (isWin()){
           int hits = 64 - tries;
           int misses = hits- hit;
           int score = ((tries+hit)/misses)*64;
           missilesLeft = tries - 30;
           mis = missilesLeft;
           JOptionPane.showMessageDialog(this, "You WIN!\n \nMissiles used: "+hits+"\nMissiles left: "+missilesLeft+"\nHits: "+hit+"\nMisses: "+misses+"\nScore: "+score );
         //Game Over
         if (isGameOver()){
           JOptionPane.showMessageDialog(this, "  GAME OVER!!\n*******************\nYou have run out of missiles!\nTRY AGAIN");
    //BattleWindow
    private void build(){
              main = new JPanel(new BorderLayout());
              title = new JPanel(new FlowLayout(FlowLayout.CENTER));
              right= new JPanel(new FlowLayout(FlowLayout.CENTER));
              left = new JPanel(new FlowLayout(FlowLayout.CENTER));
              bottom = new JPanel(new FlowLayout(FlowLayout.RIGHT));
              displayField = new JTextField("000", 8);
              displayField.setEditable( false );
              b = new Battleship();
              JLabel t = new JLabel("Battleship Potemkin");
              Font myFont =  new Font("Arial",Font.BOLD,32);
              t.setFont(myFont);
              title.add(t);
              help = new JButton("Help");
            exit = new JButton("Quit");     
            help.setFont(new Font("Arial", Font.BOLD, 17));
            exit.setFont(new Font("Arial", Font.BOLD, 17));
            displayField.setFont(new Font("Arial", Font.BOLD, 22));
              main.add(title,BorderLayout.NORTH);
              main.add(left,BorderLayout.WEST);
              main.add(right,BorderLayout.EAST);
              main.add(bottom,BorderLayout.SOUTH);
              main.add(b,BorderLayout.CENTER);
             this.add(main);
              help.addMouseListener(this);
              exit.addMouseListener(this);
              bottom.add(displayField);
              bottom.add(help);
              bottom.add(exit);
              setSize(500,600);
              setResizable(false);
              String aString = Integer.toString(bob);
              displayField.setText(displayField.getText() + bob);
              //displayField.setText("bob");
              }the variable bob in must have the same value as missilesLeft
    thank you

  • Passing Array variables between objects

    While troubleshooting a Flash app, it took me hours to figure
    out that you need to make a duplicate of an Array variable if you
    are passing it between objects. Otherwise, any alterations that you
    make to the array will result in the original array being altered
    as well as the "new" array.
    I'm no developer, can someone please explain why you have to
    do this? Or, give me an instance when you wouldn't want to make a
    duplicate? Just trying to understand.
    Thanks.

    it is because if you do something like this
    a=[1,2,3]
    b=a
    all you are doing is storing a reference to a in a variable
    b.Instead, either copy oput the array again or use one of the array
    methods which return an array eg
    b=a.slice()
    b=a.concat()

  • How to pass local variables between different sequence files?

    Actually i want to pass the data (local variable) from my process model file to a client file. The client file only has the callbacks and those callbacks require some parameters as input which is available in local variables of my process model sequence file. I do not want to use Station Globals.
    Please tell me any other way by which i can pass that data.

    Which Locals do you want from the model.  Every sequence has it's own Locals and there are a bunch of sequences in every process model.  Do you want the entry point's Locals?  A callback's Locals?  Just one of the sequence's Locals?  Some Models have way more entry points than others.  What if your sequence file is ran with a different entry point?
    One option is to create your own callback in the model and pass the data to it as parameters.  Then add that callback to your client sequence file and get it out of the parameters.
    If you simply want the entry point's locals and you are in your Main Sequence then you could use RunState.Caller.Locals.VariableName.  This assumes you will use the same entry point every time you run that sequence file.  Or assumes that every entry point you run has the same Local variable name.
    Maybe there is an API method that exposes what you are looking for.  What is your goal?
    Regards,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • Re: Passing a Variable Between 2 Classes (school project)

    return job.customerCode(custCd);There is no customerCode() method, there is also no custCd variable.

    public double getApplicableDiscount()
        return applicableDiscount;
    }There is no applicableDiscount variable.

  • Passing string variables between servlets

    Hello
    I need to pass an SQL string constructed in Java servlet A to Java servlet B where it can be executed.
    For example:
    In servlet A I have:
    String cmd = ("select x from y where z");
    cmd is then passed to the server as a hidden form field and read by servlet B as:
    if (paramName.equals("cmd")) {
    String cmd = paramValue;
    However, displaying cmd in servlet B shows only:
    "select"
    Is there a way around this at all? That is, other than converting all spaces to another character in servlet A and reinstating the spaces in serlvet B?
    Thanks
    Martin O'Shea.

    marti,
    you are posting the form aren't you... not getting it?
    I'm suspecting that it's a side-effect of URL rewriting.
    http://en.wikipedia.org/wiki/Rewrite_engine
    And of course a better approach is create user model in the session facade... and if you don't know what that means then forget it.
    keith.

Maybe you are looking for

  • Photoshop cs4 - crash bib.dll

    On a photoshop cs4 64 bit installation the program have problems running suddenly. I have worked for 6 month without problem, but now there suddenly is the problem: I can start photoshop, but If I for example just open af empty sheet at choosing the

  • Strange font problem

    Hey, I am trying to write a program which will consistantly display all text (across all platforms) in the same font. I chose "Lucida Sans" since it comes with the JRE. When I compile and run my program, it displays all text in "Lucida Sans" as expec

  • Macbook Pro and Dragon Dictate 2.0

    Anyone have Dragon Dictate 2.0 on their Macbook Pro? I'd like Dragon Dictate 2.0 but not sure if my computer would handle it without freezing up or even run it at all. I don't have Snow Leopard but the system requirements don't say I need it (althoug

  • Problems with uninstalling and installing

    I have already installed Adobe Premiere Pro CC and thought I would uninstall and try another editing programme for Mac to see what else there was to use. However to uninstall it I draged every file that had something to do with the software into my r

  • Please tell me sap bw consultant roles and responsiblities in immp project?

    this is shyam plz inform