Passing a param to a function

Okay... So I am having another problem.
I have created an array and have no problem passing it to a
function as a param via set interval, as follows:
// Create a text field and import text from outside txt file
this.createTextField("aText", 1, 0, 0, 1, 1);
var a_lv:LoadVars = new LoadVars();
a_lv.onData = function(src:String):Void {
if (src != undefined) {
aText.text = src;
makeA();
} else {
aText.text = "Unable to load external file.";
a_lv.load("a.txt");
var obNum = 0;
function makeText(whichArray) {
trace(whichArray);
obNum++;
var newObject = "myOb"+obNum;
var newclip = createEmptyMovieClip(newObject, obNum);
newclip.createTextField("newText", 0, 0, 0, 100, 100).text =
whichArray[Math.round(Math.random()*whichArray.length-1)];
trace(newclip.newText.text);
newclip._x = Math.ceil(Math.random()*300);
newclip._y = Math.ceil(Math.random()*300);
function makeA() {
var a_str:String = aText.text;
var a_array:Array = a_str.split(" ");
trace(a_array);
myInterval = setInterval(_root, "makeText", 1000, a_array);
The problem is when I try to pass the param via a button:
on (keyPress "a") {
makeText(a_array);
it comes out as undefined.
What is wrong with my param pass???
I know this must be very simple, but I seem rather
addle-brained today...

a_array is a temporary variable that exists ony inside makeA
while its executing.
try declaring it outside makeA
var a_array:Array=[];
and inside makeA just use
a_array= a_str.split(" ");
perhaps there's other things that need attention, but that
was the first thing that jumped out at me. Also can I suggest you
use the attach Code button to post your code. It makes it easier to
read if its longer than a few lines and avoids the possibility of
errors being introduced because of formatting codes used in the
forum posts.

Similar Messages

  • Passing parameter for the bean function that deletes record from DB

    I need to delete some record from the DB without updating the reset of the user screen.
    I use commandButton with immediate attribute as true, because validation should be skipped.
    So, I can't rely on backing bean values being updated, but need to pass a param to the function that does the delete (deleteTemplate) function below.
    The value of this param is selected value in another comboBox called "template".
    Code below is not parsing. Could you advise how to do it?
    <a4j:commandButton id="deleteTemplate" value="Delete"
                             action="#{qtBeanParam.deleteTemplate(param['piPerformanceReturnsForm:template'])}" immediate="true" reRender="template,templateList,templateOwner,templateOwnerList"
                             styleClass="blue-button">
                        </a4j:commandButton>Error Parsing: #{qtBeanParam.deleteTemplate(param['piPerformanceReturnsForm:template'])}

    Thank you for your reply.
    Could I pass the value that is entered in some other field as a "parameter" though?
    <f:param name="anyName" value="parameter" />
    For example the value from the following comboBox?
    <rich:comboBox id="template" width="250" value="#{qtBeanParam.templateName}" enableManualInput="true"
                                  converter="#{templateConverter}" valueChangeListener="#{qtBeanParam.changeTemplate}" >
                                  <a4j:support event="onselect" reRender="template,templateList" ajaxSingle="true" />
                                  <a4j:support event="onchange" reRender="template,templateList" ajaxSingle="true" />
                             <f:selectItems id="templateList" value="#{qtBeanParam.templateList}" />
                        </rich:comboBox>

  • Passing parameter values to powershell function from batch file

    Hello ,
       I haven't used powershell for a while and getting back to using it. I have a function and I want to figure out how to pass the parameter values to the function through batch file.
    function Check-FileExists($datafile)
    write-host "InputFileName : $datafile"
    $datafileExists = Test-Path $datafile
    if ($datafileExists)
    return 0
    else
    return -100
    <#
    $datafile = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_011.txt"
    $returncode = Check-FileExists -datafile $datafile
    Write-Host "ReturnCode : $returncode"
    $datafile = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"
    $returncode = Check-FileExists -datafile $datafile
    Write-Host "ReturnCode : $returncode"
    #>
    The above code seems to be work when I call it. But when I try to call that script and try to pass the parameter values, I am doing something wrong but can't figure out what.
    powershell.exe -command " &{"C:\Dev\eMetric\PreIDWork\PowerShell\BulkLoad_Functions.ps1" $returncode = Check-FileExists -datafile "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"}"
    Write-Host "ReturnCode : $returncode"
    $file = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"
    powershell.exe -file "C:\Dev\eMetric\PreIDWork\PowerShell\BulkLoad_Functions.ps1" $returncode = Check-FileExists -datafile $datafile
    Somehow the I can't get the datafile parameter value being passed to the function. Your help would be much appreciated.
    I90Runner

    I am not sure about calling a function in a script like how you want to. Also I see you are setting the values of the parameters, this is not needed unless you want default values if nothing is passed. The values for the parameters will be passed via the
    batch file. So for me the easiest way is as indicated.
    param
    [string]$DataFile
    function Check-FileExists($datafile)
    write-host "InputFileName : $datafile"
    $datafileExists = Test-Path $datafile
    if ($datafileExists)
    return 0
    else
    return -100
    Write-Host "Return Code: $(Check-FileExists $DataFile)"
    Then you create a batch file that has
    start powershell.exe
    -ExecutionPolicy
    RemoteSigned -Command
    "& {<PathToScript>\MyScript.ps1 -DataFile 'C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile.txt'}"
    Double click the batch file, and it should open a powershell console, load your script and pass it the path specified, which then the script runs it and gives you your output
    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
    Don't Retire Technet

  • Passing a node to Xquery function

    Hi All,
    I have two functions in my xquery. I'm trying to pass a node from one function to another function to check if it exists and do some processing on the text that is present in that node (if exists).
    declare function appendLines($node as element()) as xs:string {
         if(fn:exists($node) and $node/text() ne "") then
              fn:concat($node/text(),", ")
         else (
    appendLines($LINE_ITEM/ns0:STATXT)
    Is the above call to that function is correct?
    Thanks!!!

    declare function appendLines($node as node()*) as xs:string {
              if(fn:exists($node)) then
                   if(fn:string-length(fn:normalize-space($node/text())) > 0) then (     
                        fn:concat($node/text(), " ")
                   else (
              else (
    It worked with the above function.

  • Passing request table to Jco function

    Hello Experts,
      We have one requirement where we need to pass the table data from the BLS to SAP Jco Function Module call.  For example we are reading the material numbers from the oracle database and then we need to pass these material numbers to SAP Function Module as a table to read the further details from SAP for the given material numbers. 
      We wrote a custom function module in SAP which accepts the material number as table.  Is it possible to pass the table request parameter to Function Module?  If possible how can we do this?  I tried to pass the XML document to Function Module table, but no luck.
    Thanks
    Mohan

    Mohan,
    in the BLT, configure the JCO action to use you custom function. After pressing enter, MII reads the xml structure of the function (if the connection MII to SAP is working). In the further processing of the BLT, you can fill the RFC table which you can see in the link editor using your query results and the link editor types "AppendXML" or "AppendAfter".
    The following thread might help: [RFC call with multiple input|http://forums.sdn.sap.com/click.jspa?searchID=34070350&messageID=8134561].
    Michael

  • How can I pass variable to eventdriven startElement() function?

    I am new to java and SAX. Could anybody tell me how to pass variable to eventdriven startElement function? I tried the following code but didn't work.
    public class ReadXmlSax extends DefaultHandler
    String elementName;
    String requestName;
    Vector v = new Vector();
    public Enumeration getAttribute(String sFileName, String sTagName, String sAttrName)
         Enumeration e;
         elementName=sTagName;
    requestName=sAttrName;
    File f = new File(sFileName);
    // Use an instance of ourselves as the SAX event handler
    DefaultHandler handler = new ReadXmlSax();
    // Use the default (non-validating) parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
    // Parse the input
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse(f, handler);
    } catch (Throwable t) {
    t.printStackTrace();
    e = v.elements();
    return(e);
    //===========================================================
    // SAX DocumentHandler methods
    //===========================================================
    public void startDocument()
    throws SAXException
    public void endDocument()
    throws SAXException
    public void startElement(String namespaceURI,
    String sName, // simple name
    String qName, // qualified name
    Attributes attrs)
    throws SAXException
              //System.out.println(elementName);
              if (qName.equals(elementName))
                   String serverName = attrs.getValue("",requestName);
                   v.addElement(serverName);
    }

    I attached the main call the ReadXmlSax class. I added the
    "system.out.println(elementName);" in the function getAttribute and startElement as well. I got printing out "name" for elementName from function getAttribute but got others printing out "null" for elementName from function startElement. Any suggestions? thanks
    import java.io.*;
    import java.util.*;
    import ReadXmlSax;
    public class ReadElement
         public static void main(String argv[])
              ReadXmlSax r = new ReadXmlSax();
              Enumeration e = r.getAttribute("dre.xml","server","name");
              try{
                   while (e.hasMoreElements()) {
                   System.out.println((String)e.nextElement());}
              }catch(Throwable t){
                   t.printStackTrace();
    <strong>test</strong>

  • How to pass an array to a function from a SELECT statement

    Hi all. I have a problem with passing an array to a function directly from a SELECT statement.
    Here is what I want. If I have a function
    function AAA(arrayVar <ArrayType>) return number;
    I want to be able to call this function this way
    select AAA((2,3,4))
    from dual
    or this way
    select AAA((10,12))
    from dual
    In other words I want to be able to pass an arbitrary number of numbers to the function. And I want this to work in a SELECT statement.
    Does anyone have any ideas how to implement this? What <ArrayType> should I use?(I've read about VARRAY, nested tables in the Oracle documentation but as far as I've understood these array types are meant to be used within PL/SQL blocks).
    I found only this http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:208012348074 through Google but it didn't help me.
    Thank you in advance.

    > What <ArrayType> should I use?
    SQL data types - as 3360 showed above. You cannot use PL/SQL structures and user types in the SQL Engine.
    You can however use all SQL structures and types in PL/SQL.
    Arrays in SQL is created as collection type - basic o-o. The collection type (or class) serve as a container for instantiated objects or scalar type.
    This is covered in detail in [url http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14260/toc.htm]
    Oracle® Database Application Developer's Guide - Object-Relational Features

  • How to pass select-option filed to Function Module Exporting Parameter

    Hi,
        How to pass select-option filed to Function Module Exporting Parameter.
    Thanks

    Hi,
    DATA: BEGIN OF ITAB5_WRK OCCURS 0,
            KUNNR     TYPE KNKK-KUNNR,  "CUSTOMER #
            SBGRP     TYPE KNKK-SBGRP,  "CREDIT REP
            KLIMK     TYPE KNKK-KLIMK,  "CREDIT LIMIT
            NAME1     TYPE KNA1-NAME1,  "CUSTOMER NAME
            SKFOR     TYPE KNKK-SKFOR,  "TOTAL A/R
            AMT1      TYPE KNKK-SKFOR,  "CURRENT
            AMT2      TYPE KNKK-SKFOR,                          "01-30
            AMT3      TYPE KNKK-SKFOR,                          "31-60
            AMT4      TYPE KNKK-SKFOR,                          "61-90
            AMT5      TYPE KNKK-SKFOR,                          "91-120
            AMT6      TYPE KNKK-SKFOR,                          "OVR 120
            BZIRK     TYPE KNVV-BZIRK,
          END OF ITAB5_WRK.
    SELECT-OPTIONS P_COMP     FOR  T001-BUKRS
      SELECT KUNNR SBGRP  FROM KNKK
             INTO TABLE ITAB5_WRK
             WHERE SBGRP IN P_REP
               AND KUNNR GE '0001000000'
               AND SKFOR NE 0.
      LOOP AT ITAB5_WRK.
        DELETE ADJACENT DUPLICATES FROM ITAB5_WRK COMPARING KUNNR.
      ENDLOOP.
      PERFORM GET_CREDIT_LIMITS.
    *=======================================================================
      IF P_DIST NE SPACE.
        LOOP AT ITAB5_WRK.
          SELECT SINGLE * FROM KNVV WHERE KUNNR EQ ITAB5_WRK-KUNNR
                                      AND VKORG EQ P_COMP
                                      AND VTWEG EQ '20'
                                      AND SPART EQ '10'
                                      AND BZIRK IN P_DIST.
          IF SY-SUBRC EQ 0.
            MOVE KNVV-BZIRK TO ITAB5_WRK-BZIRK.
            MODIFY ITAB5_WRK.
          ELSE.
            DELETE ITAB5_WRK.
          ENDIF.
        ENDLOOP.
      ENDIF.
    *==============================================================
      LOOP AT ITAB5_WRK.
        MOVE: 'F/S'            TO WRK-KKBER,
               ITAB5_WRK-KUNNR TO WRK-KUNNR.
        PERFORM AGING.
        ADD: W_SNFAE  TO ITAB5_WRK-AMT1,
             W_SFAE1  TO ITAB5_WRK-AMT2,
             W_SFAE2  TO ITAB5_WRK-AMT3,
             W_SFAE3  TO ITAB5_WRK-AMT4,
             W_SFAE4  TO ITAB5_WRK-AMT5,
             W_SFAE5  TO ITAB5_WRK-AMT6,
             W_SFAEL  TO ITAB5_WRK-SKFOR,
             W_SNFAE  TO ITAB5_WRK-SKFOR.
        MOVE: 'SPEC'            TO WRK-KKBER,
               ITAB5_WRK-KUNNR TO WRK-KUNNR.
        *PERFORM AGING.*
        ADD: W_SNFAE  TO ITAB5_WRK-AMT1,
             W_SFAE1  TO ITAB5_WRK-AMT2,
             W_SFAE2  TO ITAB5_WRK-AMT3,
             W_SFAE3  TO ITAB5_WRK-AMT4,
             W_SFAE4  TO ITAB5_WRK-AMT5,
             W_SFAE5  TO ITAB5_WRK-AMT6,
             W_SFAEL  TO ITAB5_WRK-SKFOR,
             W_SNFAE  TO ITAB5_WRK-SKFOR.
        MODIFY ITAB5_WRK.
      ENDLOOP.
    FORM AGING.
      *CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'* 
      EXPORTING
          BUKRS             = P_COMP           
          KKBER             = WRK-KKBER
          KUNNR             = WRK-KUNNR
          RASID             = 'FEND'
          KLIMP             = 'X'
        IMPORTING
          SFAE1             = W_SFAE1
          SFAE2             = W_SFAE2
          SFAE3             = W_SFAE3
          SFAE4             = W_SFAE4
          SFAE5             = W_SFAE5
          SFAE6             = W_SFAE6
          SFAEL             = W_SFAEL
          SNFA1             = W_SNFA1
          SNFA2             = W_SNFA2
          SNFA3             = W_SNFA3
          SNFA4             = W_SNFA4
          SNFA5             = W_SNFA5
          SNFA6             = W_SNFA6
          SNFAE             = W_SNFAE
        EXCEPTIONS
          NO-AGING_SCHEDULE = 1
          NO_TABLE_INPUT    = 2.
      CASE SY-SUBRC.
        WHEN 1.
          MESSAGE E999 WITH 'PLEASE ENTER AGING SCHEDULE'.
        WHEN 2.
          MESSAGE E999 WITH 'DO NOTHING ??'.
      ENDCASE.
    ENDFORM.                    "AGING
    Thanks

  • Pass multiple params to a popup window iChart

    I have an irpt that has toggle buttons at the bottom of the page.  When a person clicks a toggle button a new window opens, passes the param to an iChart and displays the chart.  Currently, I am only passing one param.  My queries (current page and ichart) have 4 param and I would like to know the correct syntax in passing multiple params.
    Example:
    var SelOption = ProductID
    var strUrl = "Histogram_QA_Moistures.irpt?ID="+ ProductID;
    window.open(strUrl, "Histogram");
    My first parm is "Histogram_QA_Moistures.irpt?ID="+ ProductID
    I need to add...
    "Histogram_QA_Moistures.irpt?Line="+ Line
    "Histogram_QA_Moistures.irpt?Operator="+ Operator
    "Histogram_QA_Moistures.irpt?Lot="+ Lot
    Please show me the correct syntax to line all four of these param for strUrl.
    Thanks!!

    It doesn't seem to be working.  I am able to pass the first param with your code, but I noticed something that wasn't consistant in your code.
    There wasn't an "=" after "&Operator" and "&Lot".  Should there be??  I modified the code, but I still didn't get the results I was looking for.  I should be able to pick only Line and run the chart and get only line data, but I get blank charts for everything but ProductID.
    var strUrl = "Histogram_QA_Moistures.irpt?ID="+ ProductID+"&Line="+Line+"&Operator="+Operator+"&Lot="+Lot;

  • Passing parameters to event triggered functions

    hi all,
    i have created a button and added EventListener.
    as mybutton.addEventListener(MouseEvent.CLICK,clickSt art);
    when i implement the clickStart (event:MouseEvent) function i
    want to pass
    an array ,a String to this function as parameters .how can i
    do this.
    is it possible or not.
    thanx.

    Well, not in that way.
    The function automatically receives a parameter when you
    create a callback with that function by "addEventListener", such
    parameter is datatyped as the event type you defined in the
    callback, in your case "MouseEvent". If you want to pass more data
    when the function is called then you have to create your own event
    class because almost all events just inform when something has
    happened and send limited information. You can check the
    documentation about creating a custom event class, there is a lot
    of info about the topic.

  • Passing a counter to classes/functions

    I have a passCounter that is initialized in class Passes. I need to have this passCounter keep track of what pass I am on so that it can evaluate the correct data and process it to the correct spots in the program. But the program isn't seeing the int passCounter. I was hoping someone could clue me in as to what is wrong with my implimentation. I have another function that does the same thing and doesn't cause me any errors.
    class Passes extends Header
         { public void Passes (int passCounter)
                { while (passCounter != 3)
                     { s=new SerialRead();
                    s.findPort();
                    waitForSerial=true;
                    s.openConnection(); // open the serial connection
                       while(waitForSerial)
                              torque1=line1.substring(32,37);
                           torque2=line2.substring(32,37);
                           torque3=line3.substring(32,37);
                              angle1=line1.substring(40,45);
                           angle2=line2.substring(40,45);
                           angle3=line3.substring(40,45);
                           torque1=line1.substring(1,6);
                           torque2=line2.substring(1,6);
                           torque3=line3.substring(1,6);
                           angle1=line1.substring(9,14);
                           angle2=line2.substring(9,14);
                           angle3=line3.substring(9,14);
                            serialBuffer.delete(0,((int) serialBuffer.length()));
                               if (passCounter == 1)
                                  { outputs[0].setText(torque1);
                                 outputs[1].setText(angle1);
                                 outputs[2].setText(torque2);
                                 outputs[3].setText(angle2);
                                 outputs[4].setText(torque3);
                                 outputs[5].setText(angle3);
                             else if (passCounter == 2)
                                     { outputs[6].setText(torque1);
                                    outputs[7].setText(angle1);
                                    outputs[8].setText(torque2);
                                    outputs[9].setText(angle2);
                                    outputs[10].setText(torque3);
                                    outputs[11].setText(angle3);
                             else if (passCounter == 3)
                                  { outputs[12].setText(torque1);
                                 outputs[13].setText(angle1);
                                 outputs[14].setText(torque2);
                                 outputs[15].setText(angle2);
                                 outputs[16].setText(torque3);
                                 outputs[17].setText(angle3);
                       if (passCounter == 2 || passCounter == 3)
                         { s.closeConnection(); // close the serial connection
                           line1=serialString.substring(0);
                        linetmp=serialString.substring((serialString.indexOf("ZZZ") + 3));
                        line2=linetmp.substring(0);
                        line3=linetmp.substring(linetmp.indexOf("ZZZ") + 3);
                         } else { System.out.println("Doing pass number 1");
                       ColorButtons(passCounter);
                     } // end of pass while loop
         } // end of class Passes()
    class AcceptButton1 extends Header implements ActionListener
        { public void actionPerformed(ActionEvent e)
               { blank_l1.setText("Waiting for Data from the Second Pass");
                 Passes(2); //for the second pass
                 blank_l1.setText("Data Recieved from the second pass");
    class AcceptButton2 extends Header implements ActionListener
          { public void actionPerformed(ActionEvent e)
                 { blank_l1.setText("Waiting for Data From the Third pass"); // This is always going to be one pass ahead
                   Passes(3); //class for the third pass         
                   blank_l1.setText("Data Recieved from the third pass");
          }

    I'm not sure what I want. But I went ahead and moved all the class stuff into the main class and it appears to work. I am getting:
    Exception in thread main java.lang.NumberFormatException :NULL error:
    Ton.java
    at Java.lang.Integer.parseInt(Unknown Source)
    at Ton.,init.(Ton.java:37)
    at Ton.main(Ton.java:347)
    public class Ton extends JFrame
            private JLabel title, ser_l,pass_1,pass_2,pass_3,blank_l1,blank_l2;
            private JLabel[] header;
            private JLabel[] outputs;
            private JButton accept_sno,accept_1,reject_1,accept_2,reject_2,accept_3,
                            reject_3,reject_a;
            private Ton frame;
            private String serial_no,tmpstr1,tmpstr2;
            private boolean waitForSerial;
            public JTextField serial_text;
            public StringBuffer serialBuffer = new StringBuffer();
            public int pass;
            public ActionListener a1,a2,a3,r1,r2,r3;
            final boolean shouldFill = true;
            final boolean shouldWeightX = true; // Some strange true false things
           public SerialRead s;
           public String serialString;
           public int newline1,newline2;
           public String line1,line2,line3,linetmp;
           public String spindle,torque1,torque2,torque3,angle1,angle2,angle3;
           public int tval1 = Integer.parseInt(torque1);
           public int tval2 = Integer.parseInt(torque2);
           public int tval3 = Integer.parseInt(torque3);
           public int aval1 = Integer.parseInt(angle1);
           public int aval2 = Integer.parseInt(angle2);
           public int aval3 = Integer.parseInt(angle3);
    // all the declarations, or rather, most of them
            public  Ton()
                    Container contentPane = getContentPane(); // Initialize the container
                    GridBagLayout gridbag = new GridBagLayout(); // Intitialize the GridBagLayout manager
                    contentPane.setLayout(gridbag);   // Put the gridbag inside the contentPane
                    GridBagConstraints c = new GridBagConstraints(); // Initialize the constriants
                    Font f3 = new Font("Times Roman", Font.BOLD, 12);
                    if(shouldFill)
                      { c.fill = GridBagConstraints.HORIZONTAL; // Fill the grid completely in the Horixontal plane only
                        c.insets = new Insets(6,6,6,6); // have a space of 6 pixels on all sides on the outside of the buttons
                    serial_no="";
                    outputs=new JLabel[18];
                    setSize(780, 500);
                    setTitle("Data Entry");
                    addWindowListener(new WindowAdapter() // Make sure the window
                       { public void windowClosing(WindowEvent e)  //closes and the
                             { System.exit(0);          // Program exits instead of
                             }                          // Just hiding
                    title = new JLabel(" Data Entry");
                    title.setForeground(Color.black);
                    Font myFont = new Font("Times Roman", Font.BOLD, 40);
                    title.setFont(myFont);
                    c.anchor = GridBagConstraints.NORTH;
                    c.gridwidth = 8; // span the full 8 columns
                    c.gridheight = 2; // Span 2 rows high
                    c.gridx = 2; // Start at the very left
                    c.gridy = 0; // Start at the very top
                    gridbag.setConstraints(title, c);
                    contentPane.add(title); // add the thing into the frame
                    blank_l1 = new JLabel("Enter number before running");
                    Font warnFont=new Font("Times Roman",Font.BOLD,20);
                    blank_l1.setFont(warnFont);
                    blank_l1.setForeground(Color.red);
                    c.anchor = GridBagConstraints.NORTH;
                    c.gridwidth = 6; //Span 6 columns if neccisary
                    c.gridheight = 1; //Span 1 row
                    c.gridx = 3;
                    c.gridy = 2;
                    gridbag.setConstraints(blank_l1, c);
                    contentPane.add(blank_l1); // add the thing into the frame
                    ser_l = new JLabel("Enter Number: ");
                    Font myFont2=new Font("Times Roman",Font.BOLD,15);
                    ser_l.setFont(myFont2);
                    c.gridwidth = 3;
                    c.gridheight = 1;
                    c.gridx = 3;
                    c.gridy = 3;
                    gridbag.setConstraints(ser_l, c);
                    contentPane.add(ser_l); // add the thing into the frame
                    serial_text=new JTextField("",10);
                    c.gridwidth = 1;
                    c.gridheight = 1;
                    c.gridx = 6;
                    c.gridy = 3;
                    gridbag.setConstraints(serial_text, c);
                    contentPane.add(serial_text); // add the thing into the frame
                    accept_sno=new JButton("Done"); // this has to be double clicked to work properly
                    c.gridwidth = 2;
                    c.gridheight = 1;
                    c.gridx = 8;
                    c.gridy = 3;
                    c.ipadx = 3;
                    c.ipady = 3;  // Pad the button on the inside by 3 pixels
                    gridbag.setConstraints(accept_sno, c);
                    contentPane.add(accept_sno); // add the thing into the frame
                    accept_sno.addActionListener(new DoneButton());
                    //accept_sno.addActionListener(new EnterSerial());
                    header = new JLabel[9];
                    header[0]=new JLabel("Pass No");
                    header[0].setFont(f3);
                    header[0].setForeground(Color.black);
                    c.gridheight = 1;
                    c.gridwidth = 1;
                    c.gridx = 1;
                    c.gridy = 4; // we want all the labels on the same ROW
                    gridbag.setConstraints(header[0], c);
                    contentPane.add(header[0]);
                   for (int grid_numx = 2; grid_numx <=7; grid_numx++)
                       { for(int i=0;i<=2;i++)
                           { tmpstr1="Torque S" + (char) ('1' + i);
                          tmpstr2="Angle S" + (char) ('1' + i);
                          header[i*2+1]=new JLabel(tmpstr1);
                             header[i*2+1].setFont(f3);
                             header[i*2+1].setForeground(Color.black);
                             c.gridheight = 1;
                             c.gridwidth =  1;
                             c.gridx = grid_numx;
                             c.gridy = 4;
                             gridbag.setConstraints(header[i*2+1], c);
                             contentPane.add(header[i*2+1]);
                             header[i*2+2]=new JLabel(tmpstr2);
                             header[i*2+2].setFont(f3);
                             header[i*2+2].setForeground(Color.black);
                             grid_numx++;
                             c.gridheight = 1;
                             c.gridwidth =  1;
                             c.gridx = grid_numx;
                             c.gridy = 4;
                             gridbag.setConstraints(header[i*2+2], c);
                             contentPane.add(header[i*2+2]);
                             grid_numx++;
                       } // end of while loop for header[]
                    header[7]=new JLabel("");  // A new label with a blank?
                    reject_a=new JButton("Reject Completely");  // the reject button
                    c.gridheight = 1;
                    c.gridwidth = 1;
                    c.gridx = 8;
                    c.gridy = 4;
                    c.ipadx = 3;
                    c.ipady = 3;
                    gridbag.setConstraints(reject_a, c);
                    contentPane.add(reject_a);
                    reject_a.addActionListener(new RejectPart());
                    pass_1=new JLabel("1");
                    pass_1.setForeground(Color.black);
                    c.gridheight = 1;
                    c.gridwidth = 1;
                    c.gridx = 1;
                    c.gridy = 6;
                    c.ipadx = 3;
                    c.ipady = 3;
                    gridbag.setConstraints(pass_1, c);
                    contentPane.add(pass_1);
                    pass_2=new JLabel("2");
                    pass_2.setForeground(Color.black);
                    c.gridheight = 1;
                    c.gridwidth = 1;
                    c.gridx = 1;
                    c.gridy = 7;
                    c.ipadx = 3;
                    c.ipady = 3;
                    gridbag.setConstraints(pass_2, c);
                    contentPane.add(pass_2);
                    pass_3=new JLabel("3");
                    pass_3.setForeground(Color.black);
                    c.gridheight = 1;
                    c.gridwidth = 1;
                    c.gridx = 1;
                    c.gridy = 8;
                    c.ipadx = 3;
                    c.ipady = 3;
                    gridbag.setConstraints(pass_3, c);
                    contentPane.add(pass_3);
                    outputs=new JLabel[18];
                    Font myFont3=new Font("Times Roman",Font.BOLD,16);
                    int grid_numy = 6;
                    int grid_numx = 2;
                    int i = 0;
    // this nested while loop should get all of the output and put it into the correct places
    // using GridBagLayout
                    while (i < 18) 
                         { while (grid_numy <=8)
                                { while (grid_numx <=7)
                                       { outputs[i] = new JLabel("N/A");
                                         outputs.setFont(myFont3);
    c.gridwidth = 1;
    c.gridheight=1;
    c.gridx = grid_numx;
    c.gridy = grid_numy;
    c.ipadx = 3;
    c.ipady = 3;
    gridbag.setConstraints(outputs[i], c);
    contentPane.add(outputs[i]);
    grid_numx++;
    i++;
    grid_numy++;
    for(int j = 1; j<3; j++)
    { grid_numx = 2;
    } // end of while loops
    accept_1=new JButton("Accept Pass 1");
    c.gridheight = 1;
    c.gridwidth = 1;
    c.gridx = 8;
    c.gridy = 6;
    c.ipadx = 3;
    c.ipady = 3;
    gridbag.setConstraints(accept_1, c);
    contentPane.add(accept_1);
    a1=(ActionListener) new AcceptButton1();
    accept_2=new JButton("Accept Pass 2");
    c.gridheight = 1;
    c.gridwidth = 1;
    c.gridx = 8;
    c.gridy = 7;
    c.ipadx = 3;
    c.ipady = 3;
    gridbag.setConstraints(accept_2, c);
    contentPane.add(accept_2);
    a2=(ActionListener) new AcceptButton2();
    accept_3=new JButton("Accept Pass 3");
    c.gridheight = 1;
    c.gridwidth = 1;
    c.gridx = 8;
    c.gridy = 8;
    c.ipadx = 3;
    c.ipady = 3;
    gridbag.setConstraints(accept_3, c);
    contentPane.add(accept_3);
    a3=(ActionListener) new AcceptButton3();
    reject_1=new JButton("Reject Pass 1");
    c.gridheight = 1;
    c.gridwidth = 1;
    c.gridx = 9;
    c.gridy = 6;
    c.ipadx = 3;
    c.ipady = 3;
    gridbag.setConstraints(reject_1, c);
    contentPane.add(reject_1);
    r1=(ActionListener) new RejectButton1();
    reject_2=new JButton("Reject Pass 2");
    c.gridheight = 1;
    c.gridwidth = 1;
    c.gridx = 9;
    c.gridy = 7;
    c.ipadx = 3;
    c.ipady = 3;
    gridbag.setConstraints(reject_2, c);
    contentPane.add(reject_2);
    r2=(ActionListener) new RejectButton2();
    reject_3=new JButton("Reject Pass 3");
    c.gridheight = 1;
    c.gridwidth = 1;
    c.gridx = 9;
    c.gridy = 8;
    c.ipadx = 3;
    c.ipady = 3;
    gridbag.setConstraints(reject_3, c);
    contentPane.add(reject_3);
    r3=(ActionListener) new RejectButton3();
    } // End of public Ton
    public static void main(String args[])
    Ton frame = new Ton();
    frame.show();
    public void SaveData()
    { String outputString,outputFileName;
    byte[] outputBytes;
    String year,month,hour,min,sec;
    Date myDate;
    int tmpval;
    myDate=new Date();
    tmpval=myDate.getYear() + 1900;
    year=new String("" + tmpval);
    tmpval=myDate.getMonth() + 1;
    if(tmpval < 10 )
    { month=new String("0" + tmpval);
    else
    { month=new String("" + tmpval);
    String directory = File.separatorChar + "data" + File.separatorChar +
              year + month;
    new File(directory).mkdirs();
    hour=new String("" + myDate.getHours());
    tmpval=myDate.getMinutes();
    if(tmpval < 10)
    { min=new String("0" + tmpval);
    else
    { min=new String("" + tmpval);
    tmpval=myDate.getSeconds();
    if(tmpval <10)
    { sec=new String("0" + tmpval);
    else
    { sec=new String("" + tmpval);
    outputFileName= directory + File.separatorChar +
              serial_no.trim() + "." + hour +
              min + sec + ".dat";
    try
    { FileOutputStream myOut=new FileOutputStream(outputFileName);
    for(int i=0;i<3;i++)
    { outputString="Pass " + (i+1) + "," + serial_no.trim() + "," + hour + min + sec +"," + outputs[i*6].getText() + "," +
    outputs[i*6+1].getText() + "," + outputs[i*6+2].getText() + "," +
    outputs[i*6+3].getText() + "," + outputs[i*6+4].getText() + "," +
    outputs[i*6+5].getText() + "\r\n";
         outputBytes=outputString.getBytes();
         myOut.write(outputBytes);
    myOut.close();
    catch(java.io.IOException ioe)
    { System.out.println("Cannot write to file");
    } // End of save data
    public void ClearPass(int passNo)
    { for(int i=0;i<6;i++)
    { outputs[(passNo-1)*6+i].setText("N/A");
    } // End of clear pass
    public void ColorButtons(int passCounter)
    {  // this thing needs to look at the pass data and evaluate whether it is good or not
    // and color the buttons occordingly
    while (passCounter == 1)
    { if (( tval1 <= 45.00) || (tval1 >= 200.00))
    { accept_1.setBackground(Color.red);
    else { accept_1.setBackground(Color.green);
    if (( tval2 <= 45.00) || (tval2 >= 200.00))
    { accept_2.setBackground(Color.red);
    else { accept_2.setBackground(Color.green);
    if ((tval3 <= 45.00) || (tval3 >= 200.00))
    { accept_3.setBackground(Color.red);
    else { accept_3.setBackground(Color.green);
    } // end of first pass color loop
    while (passCounter == 2)
    { if (( tval2 <= 45.00) || (tval2 >= 200.00))
    { accept_1.setBackground(Color.red);
    else { accept_1.setBackground(Color.green);
    if (( tval2 <= 45.00) || (tval2 >= 200.00))
    { accept_2.setBackground(Color.red);
    else { accept_2.setBackground(Color.green);
    if (( tval3 <= 45.00) || (tval3 >= 200.00))
    { accept_3.setBackground(Color.red);
    else { accept_3.setBackground(Color.green);
    } // end of second pass while loop
    while (passCounter == 3)
    { if (( tval1 <= 45.00) || (tval1 >= 200.00))
    { accept_1.setBackground(Color.red);
    else { accept_1.setBackground(Color.green);
    if (( tval2 <= 45.00) || (tval2 >= 200.00))
    { accept_2.setBackground(Color.red);
    else { accept_2.setBackground(Color.green);
    if (( tval3 <= 45.00) || (tval3 >= 200.00))
    { accept_3.setBackground(Color.red);
    else { accept_3.setBackground(Color.green);
    } // end of third pass while loop
    } // end of function
    public void Passes (int passCounter)
    while (passCounter != 3)
    { s=new SerialRead();
         s.findPort();
         waitForSerial=true;
         s.openConnection(); // open the serial connection
    while(waitForSerial)
    torque1=line1.substring(32,37);
         torque2=line2.substring(32,37);
         torque3=line3.substring(32,37);
    angle1=line1.substring(40,45);
         angle2=line2.substring(40,45);
         angle3=line3.substring(40,45);
         torque1=line1.substring(1,6);
         torque2=line2.substring(1,6);
         torque3=line3.substring(1,6);
         angle1=line1.substring(9,14);
         angle2=line2.substring(9,14);
         angle3=line3.substring(9,14);
         serialBuffer.delete(0,((int) serialBuffer.length()));
    if (passCounter == 1)
    { outputs[0].setText(torque1);
         outputs[1].setText(angle1);
         outputs[2].setText(torque2);
         outputs[3].setText(angle2);
         outputs[4].setText(torque3);
         outputs[5].setText(angle3);
    else if (passCounter == 2)
    { outputs[6].setText(torque1);
         outputs[7].setText(angle1);
         outputs[8].setText(torque2);
         outputs[9].setText(angle2);
         outputs[10].setText(torque3);
         outputs[11].setText(angle3);
    else if (passCounter == 3)
    { outputs[12].setText(torque1);
         outputs[13].setText(angle1);
         outputs[14].setText(torque2);
         outputs[15].setText(angle2);
         outputs[16].setText(torque3);
         outputs[17].setText(angle3);
    if (passCounter == 2 || passCounter == 3)
    { s.closeConnection(); // close the serial connection
    line1=serialString.substring(0);
         linetmp=serialString.substring((serialString.indexOf("ZZZ") + 3));
         line2=linetmp.substring(0);
         line3=linetmp.substring(linetmp.indexOf("ZZZ") + 3);
    } else { System.out.println("Doing pass number 1");
    ColorButtons(passCounter);
    } // end of pass while loop
    public void Rejects( int passCounter)
    while (passCounter <= 3)
    s=new SerialRead();
         s.findPort();
         waitForSerial=true;
         s.openConnection();
    while(waitForSerial)
         blank_l1.setText("Data Received. Please verify data!");
         s.closeConnection();
    serialString=serialBuffer.toString();
         line1=serialString.substring(0,(serialString.indexOf("ZZZ")));
         linetmp=serialString.substring((serialString.indexOf("ZZZ") + 3));
         line2=linetmp.substring(0,(linetmp.indexOf("ZZZ")));
         line3=linetmp.substring(linetmp.indexOf("ZZZ") + 3);
    /* torque1=line1.substring(32,37);
         torque2=line2.substring(32,37);
         torque3=line3.substring(32,37);
         angle1=line1.substring(40,44);
         angle2=line2.substring(40,44);
         angle3=line3.substring(40,44);
         torque1=line1.substring(1,6);
         torque2=line2.substring(1,6);
         torque3=line3.substring(1,6);
         angle1=line1.substring(9,13);
         angle2=line2.substring(9,13);
         angle3=line3.substring(9,13);
         serialBuffer.delete(0,((int) serialBuffer.length()));
    if (passCounter == 1)
    { outputs[0].setText(torque1);
         outputs[1].setText(angle1);
         outputs[2].setText(torque2);
         outputs[3].setText(angle2);
         outputs[4].setText(torque3);
         outputs[5].setText(angle3);
    else if (passCounter == 2)
    { outputs[6].setText(torque1);
         outputs[7].setText(angle1);
         outputs[8].setText(torque2);
         outputs[9].setText(angle2);
         outputs[10].setText(torque3);
         outputs[11].setText(angle3);
    else if (passCounter == 3)
    { outputs[12].setText(torque1);
         outputs[13].setText(angle1);
         outputs[14].setText(torque2);
         outputs[15].setText(angle2);
         outputs[16].setText(torque3);
         outputs[17].setText(angle3);
    } // end of while loop
    It compiles, but it does not run. I get the errors I mentioned above when I try to run the program.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     

  • Can I pass a param to the backing bean method?

    For example:
    <h:dataTable id="recentUpdateTable" var="video" value="#{VideoListBean.recentUpdated}">
    I want to pass a param to VideoListBean.getRecentUpdated(). The param can not be a request param
    How to do it?
    Thanks in advance.

    Maybe I should describe my question more clearly.
    For example:
    <h:dataTable id="foo1" var="list" value="#{test.list">
    <h:dataTable id="foo2" var="video" value="#{test.subList}">
    </h:dataTable>
    </h:dataTable>
    The subList is determined by a property of list but how can I pass the property to test.getSubList() ?
    Thank you!
    Message was edited by:
    zhlmmc

  • Passing multiple dynamic params to JS function

    Hi,
    I have a problem that I have been grappling with for some time now.
    My JSP shows the user a list of textboxes dynamically, depending on a value from the DB. So, if the field value is 10, the user will see 10 textbixes and they will sequentially be assigned names as - text1, text2.....
    The problem arises when I try to pass the values of these textboxes to a JS function. Now, my function does not know how many params to expect, so I am trying to send it as a single string separated by : (colon).
    My method call looks like this -
    <input type="button" value="Click Here" style="width:140px;"
                   onClick="myJSFunction(
    <c:forEach var="item" items='${sessionScope.textFields}' varStatus="status">
              document.form.text<c:out value='${status.count}'/>.value+':'
                        </c:forEach>
                        );">          
    Pls. note that I am putting the colon at the end of every call in the forEach loop.
    I get a syntax error if I run this code for more than 1 textbox. The compiler expects a closing bracket ) at the end of the last line, which I have already provided.
    Is there any other way to do this or is there anything obviously wrong with my code?
    Thanks in advance.

    There are several ways around it.
    javascript can have any number of parameters passed to a function.
    You don't even have to declare them.
    You can reference them as arguments[0], arguments[1], arguments[2]...
    Another suggestion: pass up the "basename" and a count of how many fields there are and use the "eval" function
    var base = "document.myform.text";
    for (var i = 0; i<numFields; i++){
      var value = eval(base + i + ".value");
    }or something like that (sorry don't have time to check it right now)

  • How tp pass a param?

    Hi
    I have a jsf site where i set a value in a Bean.
    in the next page a jsp i can read this param with
    h:outputText value="#{ModelBean.param}"
    I have in this jsp some java functions
    If i call this function
    <% testfunction("#{ModelBean.param}")>
    the function gets the String "#{ModelBean.param" and not the passed param.
    How can i solve this problem?
    Thank for your help
    And sorry about my bad english

    Go to the folllowing thread. This might help u.
    I m also facing the same problem.
    http://forum.java.sun.com/thread.jspa?threadID=650526&tstart=15

  • Error while passing a table to a function module

    Hi Iam passing a table g_tab of length 376 flat structure to the function module..under TABLES section parameter.
    Changedocument_read_headers.
    iam getting a complile time error like the below displayed thing. Can u tell me how to solve this ?
    In the function module interface, you can specify only
    fields of a specific type and length under "I_CDHDR".
    Although the currently specified field
    "G_CDHDR_TAB" is the correct type, its length is incorrect.
    Edited by: kiran kumar on Jul 7, 2008 8:53 AM

    probably u making a mistake while declaring the table
    declare it like this in the tables section:
    S_JOB     LIKE     RNGE_OBJID
    where s_job is the internal table name and RANGE_OBJID is a structure type and NOT an internal table type.

Maybe you are looking for

  • Cannot remove  Icon from desktop

    I had to copy some files from an SD onto my desktop for a class project and now no matter what I do the folder for the SD card wont go away. I can't eject it or put it in the trash or anything. I no longer have access to the SD card to try to re-ejec

  • No sync \ Vista

    Hello, Vista and iPod shuffle second gen. Itunes will not sync. The iPod is found, iTunes reads sync in process, do not remove, but nothing syncs. Autofill works, I can copy playlists to the device, etc. Trying to sync only checked items. Both iPod a

  • INTEGRATION ORACLE ADF APPLICATION TO SAP

    Dear SDN Member, We have a requirement wherein we are supposed to connect ORACLE ADF application to SAP Application. Please advice if there is any cook-book to accomplish this task. Thanks in anticipation. ~ Syed. <email removed by moderator> Message

  • Doubt in anonymous Block

    Hi, if run the below anonymous Block,it shows ouput as NULL, I want to display the column names from the cursor. DECLARE V_PK_COLS VARCHAR2(400); P_COLUMN_NAME VARCHAR2(400) := 'CF_FEEDBACK_KEY,CF_CUSTOMER_KEY'; P_TABLE_NAME VARCHAR2(400) := 'T_ID_CM

  • I am not able to link my bank account with the store .... So I am not able to download anything from the store plz help

    Plz help in liking my account with the apple store     Because I am not able to download anything from apple store