Using multiple variable names in a for statement?

I have searched, and I just can't seem to find how to do something, I do not have the code atm, but easy enough to explain...
I have a GUI that has 3 rows of 3 fields...
emp1Name, emp1Phone, emp1Fax
emp2Name, emp2Phone, emp2Fax
emp3Name, emp3Phone, emp3Fax
I also have a tabbed file that has the input for each of these fields, it looks something like...
Mike 602-111-1111 602-111-1112
Dave 602-222-2222 602-222-2223
Bethany 602-333-3333 602-333-3334
Here is my method...
    private void getFile() {
        myFile = new File("C:/javainput.txt");
        msgField.setText("Welcome!");
        try {
            BufferedReader br = new BufferedReader(new FileReader(myFile));
            String s;
            while ((s=br.readLine())!=null){
                String f[] = s.split("\t");
                emp1Name.setText(f[0]);
                emp1Phone.setText(f[1]);
                emp1Fax.setText(f[2]);
            br.close();
        } catch (IOException e) {
            msgField.setText("INPUT FILE NOT FOUND!");
    }My question is, how do I cycle through emp1, emp2 and emp3 in a for statement. I tried empName, but that obviously isn't correct.
Help, or point me to where I can read on this?
Thank you!
Edited by: 805764 on Oct 27, 2010 12:10 PM

Do one thing at a time. First, define your Employee class. Compile it, debug it. Test it. Make sure that you can create Employees, set their names, phone numbers, etc., and get them back.
Once that works, familiarize yourself with arrays, if necessary, completely separately from your Employee class.
Once you're comfortable with arrays and with defining a new class (i.e., Employee), write a tiny test program that just, say, creates an array of a certain size and populates it with Employees, and then iterates over it printing out each Employee's information to the console.
Once that works, set it aside. Now work on a GUI. Start by just displaying one or two hardcoded names and phone numbers. Once that works, add a bit more to it--say by getting that hardcoded information from inside Employee objects.
And so on.
Right now you're biting off too much at once. Keep working on one very small new step at a time, only move on to the next step once the previous one is solid, and do the steps independently of each other first, and then combine their respective results. It may sound like a lot of work, but I promise you, in the end, it's faster, easier, and far less frustrating to do it this way.
At any given step, if you get stuck, post a question here, providing an [url http://sscce.org]SSCCE that shows what you're trying to do, and clearly explain exactly what problems you're having.

Similar Messages

  • Error while using the variable name "VARIABLE" in variable substitution

    Hi Experts,
      I am using variable substitution to have my output filename set as a payload field value. It is working fine when I am using the variable name as fname, subs etc but channel goes in error when I am using the variable name as "VARIABLE". This is probably a reserved word but i would like to know where i can find a detailed documentation on this. Say things to note / restrictions while using variable substitution.
    This is the error in the channel:
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: java.text.ParseException: Variable 'variable' not found in variable substitution table
    Thanks,
    Diya

    Hi Zevik,
    Thanks for the reply. The output file is created correctly by merely changing the variable name to something else and hence the doubt.
    Below is the configuration:
    Variable Substituition
    VARIABLE    payload:interface_dummy,1,Recordset,1,Header,1,field1,1
    Filename schema : TEST_%VARIABLE%.txt
    Output xml structure:
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns:interface_dummy xmlns:ns="http://training.eu.unilever.com">
    - <ns:Recordset xmlns:ns="http://training.eu.unilever.com">
    - <Header>
      <identifier>HDR</identifier>
      <field1>001</field1>
      <field2>001</field2>
      <field3>R</field3>
      </Header>
    - <Detail>
      <identifier>A</identifier>
      <field1>000000002</field1>
      <field2 />
      <field3>Doretha.Walker</field3>
      </Detail>
    I thimk my configuration is correct as it is working correctly with the variable name change, However, maybe i missed something !

  • Using Multiple Domain Names to Access Our Portal

    We operate one domain corp.company.com but all internal intranet web servers get  assigned the address inside.ZZZ. The inside.ZZZ is on our IE exclusion list but company.com is not. Adding company.com seems to be a miserable task so we are looking at adding an alias so our users can access the server at the new inside.ZZZ url. We have DNS pointing the URL to the right server and that seems to be working properly.
    Something within the application is redirecting the page to gnwhepdev.corp. company .com (our server’s domain address) after the initial login.  Since *.corp. company .com is not in the exclusion list, it is considered an outside address and rerouted.  We are trying to find some way to pass the alias within the  application itself so that we don’t need *.corp. company .com in the exclusion list and we can point users to the inside.ZZZ url.
    Our team researched this issue and found documentation that supported the use of multiple domain names to access a Enterprise Portal.  The documentation that we found is below:
    How To…Configure the J2EE Engine Deployment Descriptor (Version 1.00 – July 2004)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d0eb8120-b66c-2910-5795-894f384fc054
    Particularly on page 13-15 in the documentation it talks about enabling the portal via multiple domain names (Section 3.7:  Using Multiple Domain Names to Access the Portal).  Also, the documentation says the following:
         You must have sever proxy servers, each with a different domain name.  You then activate the filter mechanism and configure it to work with several proxy servers
    We have several questions about the possiblities of being able to set this up and whether it would require another server where Web Dispatcher would need to be installed for this configuration to work properly.  Can someone please provide some insight into what needs to be configured and answer the question about the Web Dispatcher?  Also, if Web Dispatcher is required, what steps need to be done to configure?  If Web Dispatcher is not needed, what will we need to do apart from that to set this up for our Enterprise Portal system?

    It is but you have to use masking......
    http://iwebfaq.org/site/iWeb_Domains.html

  • Use a variable name within a function?

    here's my function....
    myInterval = setInterval (TTMO,15);
    function TTMO () {
    InstanceNameOfMovieClip._x -= (InstanceNameOfMovieClip._x -
    _xmouse)/10;
    InstanceNameOfMovieClip._y -= (InstanceNameOfMovieClip._y -
    _ymouse)/10-2;
    instead of using the "InstanceNameOfMovieClip" can i use a
    variable name? i've tried, but it doesn't work. i also tried using
    the correct hierarchy too, such as this._parent.VariableName
    too.

    you need to concat the linkage to the movieclip using your
    string variable like this
    var mcName_str = "bigBox_mc";
    this[mcName_str]._x = 20;
    you can use this method for looping through incrementally
    named objects
    for(var i:Number=0;i<10;i++)
    this["mc"+i]._x = 20;
    hope that helped

  • [svn:sb-sherlock] 13663: Improved javadoc, variable names, and comments for calcCheckBits().

    Revision: 13663
    Revision: 13663
    Author:   [email protected]
    Date:     2010-01-20 09:58:41 -0800 (Wed, 20 Jan 2010)
    Log Message:
    Improved javadoc, variable names, and comments for calcCheckBits().
    Also added an assertion to enforce a pre-condition on one input.
    r=etierney+
    tests: flex checkin tests
    Modified Paths:
        flex/sdk/sandbox/sherlock/modules/compiler/src/java/flex2/compiler/CompilerAPI.java

  • How to use a table name in the select statement using a variable?

    Hi Everybody,
                       I got a internal table which has a field or a variable that gets me some tables names. Now I need to retrieve the data from all these tables in that field dynamically at runtime. So could you suggest me a way out to use the select query which uses this variable as a table ?
    Regards,
    Mallik.

    Hi all,
    Actually i need some more clarification. How to use the same select statement, if i've to use the tabname in the where clause too?
    for ex : select * from (tab_name) where....?
    Can we do inner join on such select statements? If so how?
    Thanks & Regards,
    Mallik.

  • Firefox will not remember multiple user names and passwords for same site, yet it used to do so. Any ideas?

    I belong to several publishers website, and I often have to access more than one author's account, which requires that I use their user name (usually an email address) and their password. In the past, whenever I double clicked on the space for user name, I would see all of those user names appear that I use for that site. When I clicked on the one I wanted, the stored password would appear in the password window, and I could log in. Now, it only shows me the most recent user name that I have used. I don't understand how to make it do what it used to do. Any ideas?

    Is it possible that that name is stored in a "remember me" cookie ?
    *"Remove the Cookies" from that site: Firefox > Preferences > Privacy > Cookies: "Show Cookies"

  • HOW CAN I  USE MULTIPLE INNERJOINS IN A SINGLE SELECT STATEMENT?

    HI,
    I AM SHABEER AHMED,
    I AM GETTING AN ERROR WHILE I ATTEMPT TO EXECUTE A SELECT STATEMENT WITH MULTIPLE INNER JOINS . BECOZ I WANT TO FETCH ITEM DATA, PARTNER DATA  BASED ON HEADER DATA .
    THEN OF COURSE I HAVE FETCH DATA FROM VBAK VBAP VBKD SO LZ SEND ME THE SOLUTION.
    BYE

    Hi,
    1.Just see this:
    SELECT * INTO CORRESPONDING FIELD OF TABLE itab
    FROM t1 INNER JOIN t2 ON t1f4 EQ t2f4
    INNER JOIN t3 ON t2f5 EQ t3f5 AND
    t2f6 EQ t3f6 AND
    t2f7 EQ t3f7.
    2.But better to use for all entries.It increases the performance.
    FOR ALL ENTRIES
    Tabular Conditions
    The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:
    SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...
    <cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.
    The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.
    You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.
    Example for ALL ENTRIES
    DATA: TAB_SPFLI TYPE TABLE OF SPFLI,
    TAB_SFLIGHT TYPE SORTED TABLE OF SFLIGHT
    WITH UNIQUE KEY TABLE LINE,
    WA LIKE LINE OF TAB_SFLIGHT.
    SELECT CARRID CONNID
    INTO CORRESPONDING FIELDS OF TABLE TAB_SPFLI
    FROM SPFLI
    WHERE CITYFROM = 'NEW YORK'.
    SELECT CARRID CONNID FLDATE
    INTO CORRESPONDING FIELDS OF TABLE TAB_SFLIGHT
    FROM SFLIGHT
    FOR ALL ENTRIES IN TAB_SPFLI
    WHERE CARRID = TAB_SPFLI-CARRID AND
    CONNID = TAB_SPFLI-CONNID.
    LOOP AT TAB_SFLIGHT INTO WA.
    AT NEW CONNID.
    WRITE: / WA-CARRID, WA-CONNID.
    ENDAT.
    WRITE: / WA-FLDATE.
    ENDLOOP.
    INNER JOINS
    In a relational database, you normally need to read data simultaneously from more than one database table into an application program. You can read from more than one table in a single SELECT statement, such that the data in the tables all has to meet the same conditions, using the following join expression:
    SELECT...
    FROM <tab> INNER JOIN <dbtab> AS <alias> ON <cond> <options>
    where <dbtab> is a single database table and <tab> is either a table or another join expression. The database tables can be specified statically or dynamically as described above. You may also use aliases. You can enclose each join expression in parentheses. The INNER addition is optional.
    A join expression links each line of <tab> with the lines in <dbtab> that meet the condition <cond>. This means that there is always one or more lines from the right-hand table that is linked to each line from the left-hand table by the join. If <dbtab> does not contain any lines that meet the condition <cond>, the line from <tab> is not included in the selection.
    The syntax of the <cond> condition is like that of the WHERE clause, although individual comparisons can only be linked using AND. Furthermore, each comparison must contain a column from the right-hand table <dbtab>. It does not matter on which side of the comparison it occurs. For the column names in the comparison, you can use the same names that occur in the SELECT clause, to differentiate columns from different database tables that have the same names.
    The comparisons in the condition <cond> can appear in the WHERE clause instead of the ON clause, since both clauses are applied equally to the temporary table containing all of the lines resulting from the join. However, each join must contain at least one comparison in the condition <cond>.
    Example for INNER JOINS
    REPORT demo_select_inner_join.
    DATA: BEGIN OF wa,
    carrid TYPE spfli-carrid,
    connid TYPE spfli-connid,
    fldate TYPE sflight-fldate,
    bookid TYPE sbook-bookid,
    END OF wa,
    itab LIKE SORTED TABLE OF wa
    WITH UNIQUE KEY carrid connid fldate bookid.
    SELECT pcarrid pconnid ffldate bbookid
    INTO CORRESPONDING FIELDS OF TABLE itab
    FROM ( ( spfli AS p
    INNER JOIN sflight AS f ON pcarrid = fcarrid AND
    pconnid = fconnid )
    INNER JOIN sbook AS b ON bcarrid = fcarrid AND
    bconnid = fconnid AND
    bfldate = ffldate )
    WHERE p~cityfrom = 'FRANKFURT' AND
    p~cityto = 'NEW YORK' AND
    fseatsmax > fseatsocc.
    LOOP AT itab INTO wa.
    AT NEW fldate.
    WRITE: / wa-carrid, wa-connid, wa-fldate.
    ENDAT.
    WRITE / wa-bookid.
    ENDLOOP.
    Regards,
    Shiva Kumar(Reward if helpful).

  • Using Presentation variables..along with case statements..

    Hi All.
    I have a issue using presentation variable along with CASE statements. My approach is
    1) I have a dashboard prompt, which is being set as Presentation variable.
    Based on the value selected in prompt, for ex the values of prompt can be 'ABC' and 'DEF'.
    I have a calculated column, the calculation goes this way...
    The forumal is
    CASE WHEN @{Presentation Variable Name} = 'ABC' THEN xxxxxxxxxx ELSE IF @{Presentation Variable Name} = 'DEF' END. It gives error of "no table being referenced"..
    Is this is the right approach??
    Can i get the values of variable in a column formula, so that a column can have values selected in prompt?
    Can anybody pls help me here..
    Thanks in advance...

    Hi
    Thanks for the quick response..
    I agree to ur point..
    But the requirement is
    Based on the value of the prompt I need to switch the calculation in one of the formula area of one column..
    If Prompt value is ABC then one kind of calculation in Fx and If the prompt value is DEF then one kind of calculation in the same Fx..
    How can I acheive this?
    Thanks in advance..

  • Help, can I declare an object using a variable name

    I need to make a bunch of objects using a for loop, so I was wanting to name the object one of the variables that I read. But I basically want to know if I can do this.
         private Software makeObject(String proName, int proStock, double proPrice,String objName){
              Software objName = new Software(proName,proStock,proPrice);
              return objName;
    I want to create a Software object using the objName inputted to it. The software object holds three fields as you can see. The name, num in stock, and price. However it won't let me do this, because it says objName is a duplicate variable. Help would be appreciated

    private Software makeObject(String proName, int proStock, double proPrice,String objName){
    Software objName = new Software(proName,proStock,proPrice);
    ... it won't let me do this, because it
    says objName is a duplicate variable. Help would be
    appreciatedWell, it is duplicate. Change the name of one or the other of those variable names.

  • How to use Multiple Homes on Windows Box for patching

    Reading an Article by Arup Nanda 04.23.2007 talks about using multiple oracle homes for patching. We've installed oracle again and now have 2 Oracle Homes (db_1 and db_2). If I look at my service startup for the database I see this:
    c:\oracle\product\10.2.0\db_1\bin\ORACLE.EXE TestDB.
    If I try and start my database out of the db_2 install I'l receive errors about the init file not being located in the db_2 location. Should I copy all my files from db_1 over to db_2?
    thanks.

    I'l receive errors about the init file not being located in the db_2 locationYes, of course. Otherwise the Oracle Home will never know the location of the init.ora at the old location.

  • Using list of names as input for script

    Hi all,
    I've written a script that creates a folder and sets the proper POSIX and ACL permissions based on the name I set (i.e. the username). What I'd like to do is have a list of usernames (possibly in a text file?) and perform the script for each of those users. How might I go about this? I'm including the script below in case that helps.
    Thanks!
    #!/bin/sh
    USERNAME=1234567
    mkdir /Shared Items/SharedFolder/$USERNAME
    chown root:admin /Shared Items/SharedFolder/$USERNAME
    chmod 770 /Shared Items/SharedFolder/$USERNAME
    chmod +a "$USERNAME allow read,write,writeattr,readattr,readextattr,writeextattr,execute,list,search,delete,addfile,add_subdirectory,delete_child,file_inherit,directoryinherit" /Shared Items/SharedFolder/$USERNAME

    I use sed to parse text files for this sort of thing. It filters out comments that begin with # and blank lines:
    <pre style="border: 1px solid #ddd; padding-left: .75ex; padding-top: .25em; padding-bottom: .25em; margin-top: .5em; margin-bottom: .5em; margin-left: 1ex; max-width: 80ex; overflow: auto; font-size: 10px; font-family: Monaco, 'Courier New', Courier, monospace; color: #444; background: #eee; line-height: normal">sed 's/[:blank:]*#.*//; /^$/d' /your/users.conf | \
    while read USERNAME; do
    mkdir /Shared\ Items/SharedFolder/$USERNAME
    chown root:admin /Shared\ Items/SharedFolder/$USERNAME
    chmod 770 /Shared\ Items/SharedFolder/$USERNAME
    chmod +a "$USERNAME allow read,write,writeattr,readattr,readextattr,writeextattr,execute,list,search,dele te,add_file,add_subdirectory,delete_child,file_inherit,directory_inherit" /Shared\ Items/SharedFolder/$USERNAME
    done
    </pre>

  • Using Static Variable against Context Attribute for Holding IWDView

    Dear Friends,
    I have a method which is in another DC which has a parameter of the type IWDView. In my view, I will have an action which will call the method in another component by passing the value for the view parameter. Here, I can achieve this in 2 types. One is - I declare a static variable and assign the wdDoModifyView's view as parameter value and I can pass this variable as parameter whenever calling that method or the second way - create an attribute and assign the same wdDoModifyView's view parameter as its value. Whenever I call this method, I can pass this attribute as parameter. What is the difference between these two types of holding the value since I am storing the same value i.e., wdDoModifyView's view parameter. But when I trigger the action from different user sessions, the first type of code (using static variable) prints the same value in both the sessions for view.hashCode() and View.toString(), but the same is printing the different values when I pass the attribute which holds the view parameter.
    Clarification on this is highly appreciated
    The problem I face is when I use static variable to get the view instance and export the data using the UI element's id, the data belonging to different user sessions is mixed up where as when I use Context Attribute, the same problem doesn't arise. I want to know the reason why it is so. Is there any other place or way where I can get the current view instance of each session instead of wdDoModifyView?

    Hi Sujai ,
    As you have specified the problem that we face when we use  static attributes, when end users are using the application .
    Static means i  have n number of objects but the static variable value will remain same every where.
    when it is context attribute for every object i.e nth object you have a nth context attribute i mean nth copy of the context attribute.
    so every user has a unique Iview parameter , when context is used and
    when static is used  , assume you have userA , his iview is set this intially  and u have another user B , when he is using  , since the variable is static and when you access this variable you will get the value of userA.
    Regards
    Govardan Raj

  • Using multiple variables in Dataslice

    Hello Experts,
    It appears that I can create a dataslice using variables. Here is my challenge. I have created a function to activate and de-activate the locks using a function module executed via a planning folder.
    I have two user-input variables
    plant and version.
    How can I lock individual plants per version without creating a separate dataslice for all combinations. There are many plants so I want to use the variables to decide which slice of data in the cube needs to be locked.
    or
    Can I create a dataslice via a function module like UPC_DATASLICE_INIT and
    UPC_DATASLICE_SAVE.
    Any suggestions?
    Thanks in advance
    DW

    Method IF_RSPLS_DS_METHODS~IS_PROTECTED
    DATA:
        dref  TYPE REF TO data,
        l_locked(1) TYPE c,
        l_msg TYPE edimessage,
        lv_dummy       TYPE c.
      FIELD-SYMBOLS:
        <lv_cube>          TYPE rsinfoprov,
        <lv_year>         TYPE /bic/oiyn_year,
        <ls_th_data>       TYPE ANY,
        <ls_msg>           TYPE bapiret2.
    *** create required data objects ************************************
      CREATE DATA dref LIKE LINE OF c_th_data.
      ASSIGN dref->* TO <ls_th_data>.
    *** assign values ***************************************************
      ASSIGN COMPONENT:
        '0INFOPROV' OF STRUCTURE <ls_th_data> TO <lv_cube>,
        'YN_YEAR'  OF STRUCTURE <ls_th_data> TO <lv_year>.
      LOOP AT c_th_data INTO <ls_th_data>.
    *   Do not warn for entries from other cubes
        CHECK <lv_cube> EQ 'MY_PLANNING_CUBE'.
        CLEAR : l_locked, l_msg.
        IF <lv_year> EQ '2006'.
           MOVE 'X' TO l_locked.
           EXIT. " from LOOP
        ENDIF.
      ENDLOOP.
      MOVE l_locked TO e_noinput.
    ENDMETHOD.

  • How to use multiple languages in unity connection for greetings

    Hi All,
    I have unity connection 7.5 Version. i want to use multiple languages for greetings. i mean i have different users from different geographical location. so i want to use engilsh, french and spanish. can i customize my setup like that.
    Regards
    Pardha

    Are you talking about the user greeting? Then have them record the greeting anywhere they want in whatever language they want.  If you install multiple locales you can have each user record greeting in different language as well and then the appropriate language greeting will be played on who addresses this user by using "inherit language" feature. Though this will only work when addressing messages from withn voicemail, not by dialing from phone as that will simply use the default routing rule, unless you create custom rules.
    HTH,
    Chris

Maybe you are looking for

  • USB mic recognized, but no audio.

    I have the Rode Podcaster, it was working fine on the last preview, but now it doesn't work at all. Windows recognizes it and installs some crap driver, but it there is no audio coming in from it, and any apps that try to use it throw an error like "

  • URGENT: Need to change my access number (moved to ...

    I had a US access number.  I now live in France and need a French access number.  How can I do that?  I need to make this change very quickly (within next 45 min, if at all possible). Thanks. Sophie

  • Skype keeps crashing 7.4

    Hi, Everytime I try to call somebody on skype it freezes my computer and I cant do anything. I have tried un installing skype and reinstalling and still freezes.  I am on windows 7 and never had a problem until 7.4.  Everytime it freezes I have to re

  • 8i and a Report Runtime

    I have converted my 8.0 database to 8i on my development computer. I'd like to test some Oracle Reports 3.0.6 and Forms (5.0.) that I have in production on another system runing the 8.0 database. Can I load just the runtime files for Oracle and run t

  • IOS 8 "Notes" is broken

    I Knew that updating the Operating System would inevitably mean that some app's might not initially work, but I did expect that those which were integral to the OS would, ....it appears not! This seems to me to smack of an Operating System which has