Multiple variable initialization using arrays

Hi,
In my program I want to initialize some 20 odd variables(all of the same type) to the same value having their names as Input1, Input 2 .. Input 20. Want I want to do is to use an array to do this rather than writing the 20 variables one after the other. Is there any way to do so ?
Please help.
Thanx in advance,
Gaurav

Hi Again,
I am sorry for framing the question wrongly. What i want exactly is this :
I want to create a variable no. of arrays (the number of arrays will be inputed by the user). I want to initialize them ,something like this
int Input1 [] = new int [400];
int Input2 [] = new int [400];
After this initialization I will then fill these with some info. from a file and then use it in my program.
So I want to use a for loop or some other loop so that I can achieve this.
Please help,
Thanks
Gaurav

Similar Messages

  • Using array binding to perform multiple rowupdates in one pass

    For the first time I am attempting to use array binding in VB.NET to update multiple rows via a single execution of a stored procedure. My subroutine is:
    Friend Sub UpdateSolutionStatusUsingArrays(ByVal intNumBeingUpdated As Integer, ByVal arrScenarioID() As Integer, ByVal arrSolutionID() As Integer, ByVal arrInOrOut() As Integer, ByVal arrTimePeriod() As Integer)
    Try
    'Set up the Command object
    Dim cmdUpdateSolutionStatus As OracleCommand
    cmdUpdateSolutionStatus = New OracleCommand
    cmdUpdateSolutionStatus.CommandType = CommandType.StoredProcedure
    cmdUpdateSolutionStatus.CommandText = "ProcUpdateSolutionStatus"
    cmdUpdateSolutionStatus.Connection = cnnORACLE
    cmdUpdateSolutionStatus.ArrayBindCount = intNumBeingUpdated - 1
    cmdUpdateSolutionStatus.CommandTimeout = CInt(tblOptions.Rows(intDatabaseIndex).Item("ConnectionTimeout"))
    'Add ScenarioID array as parameter
    Dim p_ScenarioID As New OracleParameter("ScenarioID", OracleDbType.Int32)
    p_ScenarioID.Direction = ParameterDirection.Input
    p_ScenarioID.Value = arrScenarioID
    cmdUpdateSolutionStatus.Parameters.Add(p_ScenarioID)
    'Add SolutionID array as parameter
    Dim p_SolutionID As New OracleParameter("SolutionID", OracleDbType.Int32)
    p_SolutionID.Direction = ParameterDirection.Input
    p_SolutionID.Value = arrSolutionID
    cmdUpdateSolutionStatus.Parameters.Add(p_SolutionID)
    'Add InOrOut array as parameter
    Dim p_InOrOut As New OracleParameter("InOrOut", OracleDbType.Int32)
    p_InOrOut.Direction = ParameterDirection.Input
    p_InOrOut.Value = arrInOrOut
    cmdUpdateSolutionStatus.Parameters.Add(p_InOrOut)
    'Add TimePeriod array as parameter
    Dim p_TimePeriod As New OracleParameter("TimePeriod", OracleDbType.Int32)
    p_TimePeriod.Direction = ParameterDirection.Input
    p_TimePeriod.Value = arrTimePeriod
    cmdUpdateSolutionStatus.Parameters.Add(p_TimePeriod)
    'Open connection
    cnnORACLE.Open()
    'Run stored procedure
    cmdUpdateSolutionStatus.ExecuteNonQuery()
    'Tidy up
    cmdUpdateSolutionStatus = Nothing
    cnnORACLE.Close()
    Catch ex As Exception
    WriteLog("Subroutine UpdateSolutionStatusUsingArrays:" & ex.Message.ToString)
    strState = "Error"
    'Update Run Status to show error has occurred
    cnnORACLE.Close()
    UpdateRunStatusORACLE(7)
    End Try
    End Sub
    When the routine tries to run cmdUpdateSolutionStatus.ExecuteNonQuery() I get the error message:
    Unable to cast object of type 'System.Int32[]' to type 'System.IConvertible'.
    I have tried all sorts of variants of the code but with no success. The arrays are being set up correctly. Anyoneone know what I'm missing?
    Stewart

    Try declaring the arrays as OracleNumber datatype instead of Integer. I've had this issue before, and I believe this is what I did to solve the problem.

  • Using Arrays in a program

    First, I would like to thank everyone in this forum for all the help they have given me over the past few weeks. With that said, I am currently trying to alter the following code to accept and use arrays to end to produce three seperate results. The program now as three hard coded variables which are
    Amount = 200000.00;
    Term = 30;
    InterestRate = .0575;
    I need to have the program work the same, but produce results for three different Terms and Three different periods. Below is the code the I am working on, I have added two arrays containing the required information. I am having a hard time coming up with a for statment to move the program through the two arrays. Any pushes in the right direction would be great. I left the hard code variable in place, I know that I do need to remove them and alter the equations. I just thought it would be easier for everyone to understand if I left the code in working form.
    import java.math.*;
    import java.text.*;
    import java.util.*;
    // The Payment class displays a predetermined monthly mortgage payment
    public class Payment
         public static void main(String[]arguments)
              //Creates Two Arrays for InterestRates and Terms
              double[] InterestRates = {.0535, .055, .0575};
              int[] Terms = {7, 15, 30};
              //Creates variables
              double Amount;
              int Term;
              double InterestRate;
              //Assigns values to variables
              Amount = 200000.00;
              Term = 30;
              InterestRate = .0575;
              //Alters the display format of Amount variable
              NumberFormat n = NumberFormat.getCurrencyInstance(Locale.US);
              String s = n.format(Amount);
              //Creates variables
              double MonthlyInterestRate;
              int TotalMonths;
              double Payment;
              //Assigns values to variables
              MonthlyInterestRate = InterestRate / 12;
              TotalMonths = Term * 12;
              Payment = Amount* MonthlyInterestRate / (1-(Math.pow((1+MonthlyInterestRate ),(-TotalMonths))));
              //Takes Payment variable and round answer to 2 decimal points
              BigDecimal bd = new BigDecimal(Payment);
    bd = bd.setScale(2, BigDecimal.ROUND_DOWN);
              //Instructions to display various varibles
              System.out.println("Cost of Mortgage "+ s);
              System.out.println("Length of Term " + Term);
              System.out.println("Interest Rate 5.75% ");
              System.out.println("The monthly payment of this loan is $" + bd);
              System.out.println();
              //Creates new set of variables
              double MonthlyInterest;
              double MonthlyPrincipal;
              double TotalInterestPaid;
              int NumberofPayments;
              //Creates Balance variable
              double Balance;
              //Initialization of Balance variable
              Balance = 200000;
              TotalInterestPaid = 0;
              NumberofPayments = 360;
              //Creates a loop that calculates the entire term of loan
              do
              MonthlyInterest = Balance * (InterestRate / 12);
              MonthlyPrincipal = Payment - MonthlyInterest;
              Balance = Balance - MonthlyPrincipal;
              TotalInterestPaid = TotalInterestPaid + MonthlyInterest;
              NumberofPayments = NumberofPayments - 1;
              //Takes current balance and rounds the answer to two digits
              BigDecimal bb = new BigDecimal(Balance);
    bb = bb.setScale(2, BigDecimal.ROUND_DOWN);
              BigDecimal tip = new BigDecimal(TotalInterestPaid);
                        tip = tip.setScale(2, BigDecimal.ROUND_UP);
              System.out.println("New Loan Balance " + bb);
              System.out.println();
              System.out.println("Total Interest Paid " + tip);
              System.out.println();
              System.out.println("Number of Payments remaining " + NumberofPayments);
              System.out.println();
              //The following lines of code pauses the loop to allow the user to read the output
              //The speed of th display can be adujusted to a wide variety of speeds
              try
                   Thread.sleep(400);
                   catch (InterruptedException exc)
              //Loop condition
              while (NumberofPayments > 0);
    //Ends Application

    Try this. It should give you some ideas. :)
    import java.math.BigDecimal;
    import java.text.NumberFormat;
    import java.util.Locale;
    // The Payment class displays a predetermined monthly mortgage payment
    public class Payment {
        public static final NumberFormat CURRENCY_FORMAT = NumberFormat.getCurrencyInstance(Locale.US);
        public static final double[] INTEREST_RATES = {.0535D, .055D, .0575D};
        public static final int[] TERMS = {7, 15, 30};
        public static final double AMOUNT = 200000.00;
        public static final int MONTHS_PER_YEAR = 12;
        public static void main(String[] arguments) {
            for (int t = 0; t < TERMS.length; t++) {
                for (int i = 0; i < INTEREST_RATES.length; i++) {
                    displayPayments(AMOUNT, INTEREST_RATES, TERMS[t]);
    private static void displayPayments(double amount, double interestRate, int term) {
    //Creates variables
    //Assigns values to variables
    double monthlyInterestRate = interestRate / MONTHS_PER_YEAR;
    int totalMonths = term * MONTHS_PER_YEAR;
    double payment = amount * monthlyInterestRate / (1 - Math.pow(1 + monthlyInterestRate, -totalMonths));
    //Instructions to display various varibles
    System.out.println("Cost of Mortgage " + CURRENCY_FORMAT.format(amount));
    System.out.println("Length of Term " + term);
    System.out.println("Interest Rate " + new BigDecimal(interestRate * 100).setScale(2, BigDecimal.ROUND_HALF_UP) + '%');
    System.out.println("The monthly payment of this loan is " + CURRENCY_FORMAT.format(payment));
    System.out.println();
    //Creates new set of variables
    double totalInterestPaid = 0.0D;
    //Creates balance variable, Initialization of balance variable
    double balance = amount;
    //Creates a loop that calculates the entire term of loan
    System.out.println("New Loan balance, Total Interest Paid, Number of Payments remaining");
    for (int numberofPayment = totalMonths; numberofPayment > 0; numberofPayment--) {
    double monthlyInterest = balance * monthlyInterestRate;
    double monthlyPrincipal = payment - monthlyInterest;
    balance -= monthlyPrincipal;
    totalInterestPaid += monthlyInterest;
    //Takes current balance and rounds the answer to two digits
    BigDecimal bb = new BigDecimal(balance);
    bb = bb.setScale(2, BigDecimal.ROUND_DOWN);
    BigDecimal tip = new BigDecimal(totalInterestPaid);
    tip = tip.setScale(2, BigDecimal.ROUND_UP);
    System.out.println(CURRENCY_FORMAT.format(bb.doubleValue()) + ", " +
    CURRENCY_FORMAT.format(tip.doubleValue()) + ", " +
    numberofPayment);
    System.out.println();
    //Ends Application

  • Can a session variable be an array?

    I have a dynamic list which may have multiple values
    selected. I can capture the resulting array in a $_POST variable.
    Using the Insert Record behavior, I cannot cause the $_POST
    variables to be sent to the redirect page unless I use session
    variables. Can a session variable be defined as an array? If so,
    how do I declare it as an array and how do I move the form variable
    array to a session variable array? If it can't be an array, how do
    I define the target variables for 0 to x items from a form variable
    array?

    I can't answer specifically for PHP but in the other
    languages as session
    variable is basically a holding place for a value. As a comma
    is a valid
    character then if you have a comma delimited list (which is
    what a form give
    you if multiple items are selected) then you simple assign it
    to the session
    variable and it will be stored as such.
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "Rankin" <[email protected]> wrote in
    message
    news:ef9suk$iqe$[email protected]..
    >I have a dynamic list which may have multiple values
    selected. I can
    >capture
    > the resulting array in a $_POST variable. Using the
    Insert Record
    > behavior, I
    > cannot cause the $_POST variables to be sent to the
    redirect page unless I
    > use
    > session variables. Can a session variable be defined as
    an array? If so,
    > how
    > do I declare it as an array and how do I move the form
    variable array to a
    > session variable array? If it can't be an array, how do
    I define the
    > target
    > variables for 0 to x items from a form variable array?
    >

  • Local variable for an Array of fixed size

    Hello,
    I have a two multirate loops in a VI. 
    In one loop, I want to refer an fixed sized array initialized in the other loop.
    But I coudn't name the array, so I can't refer it.
    Is there any way to refer it?
    Thanks,
    Young.

    If you need a local variable, there is no other way than to create an indicator for it.
    In LabVIEW there is no "fixed length" array : you can always add or remove an array element, and you don't need to declare it as in other languages. They are intrinsic dynamic objcets. Of course, the memory manager has to cope with this, that's why it's often better to initialize an array, to give it its final size immediately, resulting in faster running programs. However, this is only noticeable with relatively large arrays (> 10000-100000 elements).
    May be you should explain in more details what you intend to do, because trying to reproduce a C approach in LV is probably not the best thing to do. For instance, you said that you are initializing your array in a first loop. You mean that you re-initialize the array at each iteration ? I suppose no, so may be you could put the initialize step out of the loop, and wire the array to your two parallel loops.
    Remember also that local variables are not always good programming solutions, since using them will generate copies of their content each time they are refered to. And that can low down your program very significantly...
    Message Edité par chilly charly le 11-05-2005 05:05 PM
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Message variable initialization

    Hello,
    We had this ridiculous situation a while ago where out service instances create their variables with multiple nodes.
    For example if we have xsd looking like this:
    <element name="Response">
    <complexType>
    <sequence>
    <element name="Result">
    <simpleType>
    <restriction base="string">
    <enumeration value="OK"/>
    <enumeration value="ERR"/>
    </restriction>
    </simpleType>
    </element>
    <element name="Comment" minOccurs="0" type="string"/>
    </sequence>
    </complexType>
    </element>
    In BPEL we have message variable which part is this "Response" element. Everything is fine till the moment we start getting initial variable looking like this:
    <outputVariable>
    <part name="payload" >
    <Response>
    <Result/>
    <Result/>
    <Result/>
    <Result/>
    <Result/>
    <Result/>
    </Response>
    </part>
    </outputVariable>
    Of course we have no reason for this, no logs, no info and so on. Any idea anyone?
    Everything is normal concerning the BPEL, no errors are raised till the moment we need to populate the variable. The process is working correctly but we cannot return result to the caller.
    WL version: 10.3.5.0
    SOA version: 11.1.1.5.0
    BPEL version: 2.0
    Best regards.

    could you please send your test case to our support team? this doesn't look right. bpel engine would initialize the variable based on the xpath usage in to-spec expressions. you can try turning of variable initialization for that particular component using bpel.config.initializeVariables to false. and go with literal xml variable initiation. [http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.html#SA00038]
    http://docs.oracle.com/cd/E28271_01/dev.1111/e10224/bp_manipdoc.htm#BABHDFBJ
    here is the sample for that property
    in composite.xml, find the component, under that component add this property, and re-deploy with your literal variable init.
    <property name="bpel.config.initializeVariables">false</property>

  • Combined declaration and initialization of array

    Hello All,
    What is the difference between the below mentioned arrat initializations?
    int myArray[]=new int[] {1,2,3,4,5};
    int myArray[]={1,2,3,4,5};
    but both of them behaves in same way.
    Regards
    Sojan

    The first creates an anonymous array and copies its reference in the variable myArray. The second implicitly creates and initializes an array (there isn't really a perceptible difference). However, the second can only be used in declarations. Consider the following:
    int[] iArray = {1, 2, 3};
    iArray = new int[] {9, 8, 7}; // works
    iArray = {9, 8, 7}; // doesn't work !!!Hope this helps,
    Pierre

  • Initializi​ng arrays

    Hello!
    I'm doing a program which works with arrays. I use initialize block arrays to create them. But it depends on other variables the dimension of these arrays. If I want to change the length of a dimension I wire a variable to the block, but I have no idea what can I wire to the block to modify the number of dimensions....it cannot be modify when the program is running?? How I have to do modify the number of dimensions depends on a variable?
    Thank you in advance!
    Larson

    The initialize array function is a growable function, that is it changes the function inputs by dragging the dimensions not programatically.  There is a work around, you can use a case structure to call different versions of the function.  This will work but will only for a finite number of cases.  The other way is to initialize a multidimensional array as a single dimension and then pass it to the resize array function, i.e initialize ARRAY[i*j*k] and resize to ARRAY[i][j][k].  This is a little unusual to deal with arrays which change at runtime.  The final approach it to write polymorphic functions to handle the different cases, again you will not have full dynamic run-time handling of all possible cases but can handle a few cases easily.
    Paul
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • How to check empty string and null? Assign same value to multiple variables

    Hi,
    1.
    How do I check for empty string and null?
    in_value IN VARCHAR2
    2. Also how do I assign same value to multiple variables?
    var_one NUMBER := 0;
    var_two NUMBER := 0;
    var_one := var_two := 0; --- Gives an error
    Thanks

    MichaelS wrote:
    Not always: Beware of CHAR's:
    Bug 727361: ZERO-LENGTH STRING DOES NOT RETURN NULL WHEN USED WITH CHAR DATA TYPE IN PL/SQL:
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is NOT null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> alter session set events '10932 trace name context forever, level 16384';
    Session altered.
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> SY.

  • How to delete multiple variables from the variables list

    Hello,
    Iam using FrameMaker 9.0. Is there a way I can select multiple variables from the book and delete them together.
    Thanks,
    CP.

    NO in FM9. Take SQUIDDS TOOLBOX the free tool: 'Formats'
    'Formats' is a very helpful tool for 'deleting' paragraph formats, character formats, cross reference formats, table formats, color definitions and variables.
    You can delete unused one or all formats of selected. For paragraph and character you can also decide to 'add new one in catalog'.
    -Georg

  • Creation of Multiple Variables of same type at runtime

    Hi,
    I have a requirement in which I need to create multiple variables at run time . The variables should be TRPE REF TO CL_GENIOS_VARIABLE. The number of variables required will be determined at run time based on the number of materials in a Bill of material. We are using these variables for some calculations as GENIOS is a SAP given code to solve linear equations.
    Please help me on this. If some one can let me know how I can create field symbols dynamically with different name that will also help.

    *       CLASS lcl_genios DEFINITION
    CLASS lcl_genios DEFINITION.
       PUBLIC SECTION.
         METHODS : constructor.
         METHODS : create_model
                    IMPORTING
                      i_name TYPE genios_name,
                   create_variable
                      IMPORTING
                        i_type TYPE genios_variabletype DEFAULT if_genios_model_c=>gc_var_continuous
                        i_lowerbound TYPE genios_float DEFAULT 0
                        i_upperbound TYPE genios_float OPTIONAL
                        i_name TYPE genios_name.
       PRIVATE SECTION.
         DATA : lo_enviroment TYPE REF TO cl_genios_environment,
                lo_model TYPE REF TO cl_genios_model,
                lo_variable TYPE REF TO cl_genios_variable.
    ENDCLASS.                    "lcl_genios DEFINITION
    *       CLASS lcl_genios IMPLEMENTATION
    CLASS lcl_genios IMPLEMENTATION.
       METHOD constructor.
         lo_enviroment ?= cl_genios_environment=>get_environment( ).
       ENDMETHOD.                    "constructor
       METHOD create_model.
         lo_model = lo_enviroment->create_model( 'DUMMY' ).
       ENDMETHOD.                    "create_model
       METHOD create_variable.
         lo_variable = lo_model->create_variable( iv_type       = i_type
                                                  iv_lowerbound = i_lowerbound
                                                  iv_upperbound = i_upperbound
                                                  iv_name       = i_name       ).
       ENDMETHOD.                    "create_variable
    ENDCLASS.                    "lcl_genios IMPLEMENTATION
    DATA : lo_genios TYPE REF TO lcl_genios.
    START-OF-SELECTION.
       CREATE OBJECT lo_genios.
       lo_genios->create_model( 'DUMMY' ).
       lo_genios->create_variable( i_lowerbound = 1
                                   i_upperbound = 255
                                   i_name = 'DUMMY' ).
    You can create genios_variable like this.
    and change this :
    TYPES : Begin of lst_genios, 
                       genios TYPE REF TO cl_genios_variable, 
                    End of lst_genios. 
    like this :
    TYPES : Begin of lst_genios, 
                       genios TYPE REF TO lcl_genios, 
                    End of lst_genios. 
    or you can create your table as Kartik example.

  • Global Variable as an array

    Hi All,
    Culd you please tell me where I can declare a global variable as an array in PI 7.1.
    In PI 7.O we used to store global variables in java sections and it was recognized across mapping in message mapping
    In PI 7.1 I have declared a variable in init function in functions tab in message mapping but its not recognized in my mapping.
    Could you please help me with this?
    Where I have to declare a global variable so that I can use it anywhere in mapping?
    Thanks in advance
    Best Regards,
    Harleen Kaur Chadha

    Please refer to the below link about how to use global variables in PI 7.1.
    /people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
    This link will help you understand how to use graphical valiable as a global variable.
    Thanks,
    Hetal

  • How do I initialize an array after getting xml data via httpservice?

    I am having a problem trying to initialize an array with data from an external xml file obtained via httpservice.  Any help/direction would be much appreciated.  I am using Flex 4 (Flash Builder 4).
    Here is my xml file (partial):
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Root>
        <Row>
            <icdcodedanddesc>00 PROCEDURES AND INTERVENT</icdcodedanddesc>
        </Row>
        <Row>
            <icdcodedanddesc>00.0 THERAPEUTIC ULTRASOUND</icdcodedanddesc>
        </Row>
        <Row>
            <icdcodedanddesc>00.01 THERAPEUTIC US VESSELS H</icdcodedanddesc>
        </Row>
        <Row>
            <icdcodedanddesc>00.02 THERAPEUTIC ULTRASOUND O</icdcodedanddesc>
        </Row>
    </Root>
    Here is my http service call:
    <s:HTTPService id="icdcodeservice" url="ICD9V2MergeNumAndDescNotAllCodes.xml"
                           result="icdcodesService_resultHandler(event)" showBusyCursor="true"  />
    (I have tried resultFormat using object, array, xml).
    I am using this following Tour de Flex example as the base -http://www.adobe.com/devnet-archive/flex/tourdeflex/web/#docIndex=0;illustIndex=1;sampleId =70500
    and updating it with the httpservice call and result handler.  But I cannot get the data to appear - I get [object Object] instead.  In my result handler code  I use "icdcodesar = new Array(event.result.Root.Row);"  and then "icdcodesar.refresh();".
    The key question is: How to I get data from an external xml file into an array without getting [object Object] when referencing the array entries.  Thanks much!
    (Tour de Flex example at http://www.adobe.com/devnet-archive/flex/tourdeflex/web/#docIndex=0;illustIndex=1;sampleId =70500  follows)
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   xmlns:local="*"
                   skinClass="TDFGradientBackgroundSkin"
                   viewSourceURL="srcview/index.html">
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            @namespace local "*";
            s|Label {
                color: #000000;
        </fx:Style>
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                private var names:ArrayCollection = new ArrayCollection(
                    ["John Smith", "Jane Doe", "Paul Dupont", "Liz Jones", "Marie Taylor"]);
                private function searchName(item:Object):Boolean
                    return item.toLowerCase().search(searchBox.text) != -1;
                private function textChangeHandler():void
                    names.filterFunction = searchName;
                    names.refresh();
                    searchBox.dataProvider = names;
                private function itemSelectedHandler(event:SearchBoxEvent):void
                    fullName.text = event.item as String;   
            ]]>
        </fx:Script>
        <s:layout>
            <s:HorizontalLayout verticalAlign="middle" horizontalAlign="center" />
        </s:layout>
        <s:Panel title="Components Samples"
                 width="600" height="100%"
                 color="0x000000"
                 borderAlpha="0.15">
            <s:layout>
                <s:HorizontalLayout horizontalAlign="center"
                                    paddingLeft="10" paddingRight="10"
                                    paddingTop="10" paddingBottom="10"/>
            </s:layout>
            <s:HGroup >
                <s:Label text="Type a few characters to search:" />
                <local:SearchBox id="searchBox" textChange="textChangeHandler()" itemSelected="itemSelectedHandler(event)"/>
            </s:HGroup>
            <mx:FormItem label="You selected:" >
                <s:TextInput id="fullName"/>
            </mx:FormItem>
        </s:Panel>
    </s:Application>

    Hello,
    Instead of extracting the first zero element from the vid array, you should take that out and connect it allone.
    Attachments:
    init.bmp ‏339 KB

  • Help using arrays in java

    HI all,
    I am working on a program that will print out my initials 'A' and 'T' using arrays. I am asked to initialize the first intial to '*' and the second intial to '@'. I wrote the code but the output is wrong. Can someone help me by letting me know what I am doing wrong in my arrray?I just get back my array of 30X30. I also wrote a driver but when I run the program, I really appreciate it so much.
    public class Initial
         private char whichinitial ;
         private int MAX =30;//Maximum amount for 2-d Matrix
         char[][] letterMatrix = new char[MAX][MAX];//2-d Array 30 x30
         private boolean first = true;
         public Initial()
         { //FIlls Array full of '*'s
              whichinitial = '*';
              for(int i=0;i< MAX;i++)
                   for(int j=0;i< MAX;i++)
                        letterMatrix[i][j] = whichinitial;
         public void setLetter(char letter)
         {//Setter for Letter
               whichinitial = letter;
         public char getLetter()
         {//Getter for Letter
              return whichinitial;
         public void firstLetter()
         { //Creates an A shape
              for(int i=0;i< MAX;i++)
                for(int j=0;j< MAX;j++)
                      if((i>0)|| ((i<6) || ((j>0) && (j<29))))
                         letterMatrix[j] =whichinitial;
         public void secondLetter()
         {//Creates an T shape
              first = false;
                   for(int i=0;i <MAX;i++)
                   for(int j=0;j <MAX;j++)
                        if((i>1) ||(j < 29)||(j>5)||(i>10))
                             letterMatrix[i][j] = whichinitial;
         public void display()
         {//Displays the Initials
              if(first)
                   System.out.println("\n \n \n My First Initial," + whichinitial + ", follows:");
              else
                   System.out.println("\n \n \n My Last Initial," + whichinitial + ", follows:");
                   for(int i=0;i <MAX;i++)
                        System.out.println();
                        for(int j=0;j <MAX;j++)
                             if(letterMatrix[i][j] == '*')
                                  System.out.print(" ");
                             else
                                  System.out.print(letterMatrix[i][j]);

    I am trying to write a program using a matrix. The size of the maxtrix should be 30X30. The first initial shoulld be initialized to '*' and the secind initial should be initialized to '@'. Both initials should be 30 characters high and 30 characters wide and the initials should also represent the uppercase letter of your initials. I know that the first initial's matrix needs to be filled up vertically and the second initial needs to be filled horizontally but the output is wrong....PLease Help!
    Message was edited by:
    apples03

  • Variable initialization

    Hello guys,
    Is there anybody know how and when java checks for variable initialization?For example if we change a value, assume a without initializing it we get variable a might not have been initialized.I wish to know how java checks that the variable is already assigned or not.
    int a;
    a++;//How java checks this
    regards,
    Haddock

    Rules is:
    To variables of instance - It's default value attribute automatically if not initialize with value.
    To local variable (methods for example) - It's default value in initialization has been MUST attributed
    Instance variables has a folliwing default value:
    class A{
    int i; //default value is 0
    char c; //default value is '\u0000'
    byte b; //default value is 0
    short s; //default value is 0
    long l; //default value is 0
    float f; //default value is 0.0
    double d; //default value is 0.0
    boolean bl; //default value is false
    String str; //Object is always null
    int x[]; // null. It's Object's array
    int x[5]; // 5 times default value 0.
    void testInitializeValue(){
    int x; // Compiler error; This variable has been initialized
    if(x == 5){
    return;
    Ok..Thanks!!

Maybe you are looking for

  • Does my battery need replaced?

    Hi all, My HP dv7 notebook is almost 2 yrs old. Lately, my battery hasn't been able to maintain a charge past 85%, and the maximum charge / battery time limit has been decreasing over a couple of months. I've finally found out about the HP Support As

  • How do i scramble my iphone

    someone took my phone, they know my passcode, can I scramble it so they cant view photos, etc.?

  • BusinessObjectInfo.ObjectKey = "" for Inventory Transfer

    Hi everyone, I am using B1 2005A SP01 PL18 I catch the FormData Event (et_FORM_DATA_ADD) on ActionSucces = True and have a look at the BusinessObjectInfo.ObjectKey but its value = "". I have also tried to use B1 Tool Event Logger to see if it has a v

  • HT4623 How do I sync my iPhone to my iPad?

    Help,x

  • Nvidia Open GL driver error when Photoshop CC is open

    New PC, bought predominantly for Photoshop use. Downloaded trial of Photoshop CC and it keeps closing with this message - "Nvidia Open GL Driver detected a problem with the display driver and is unable to continue. Tha application must close. Error C