Looping thru getFiles() array

I've always heard it's best to use a sequential loop for arrays:
var fileArray = folderPath.getFiles();
for (var i = 0; i < fileArray.length; i++) {
    // Do stuff...
However, in the JavaScriptToolsGuide_CS5.pdf they use a "for - in" loop when looping through the getFiles() array:
var pics = Folder(picFolder).getFiles();
for (f in pics) {
    var file = pics[f];
Is there something different about the array created by getFiles() that makes it ok to do this?  getFiles() returns an array of File and Folder objects (or null if folder doesn't exist), so I'm assuming this is a normal array?
Thanks.

Hi,
in use:
myArray =new Array();
myArray[5] = 'five';
myArray[3] = 'three';
myArray[4] = 'four';
for ( var i in myArray) {
alert('for in ...\n' + 'index: ' + i +  '    value: ' + myArray[i]);
for(var i = 0; i < myArray.length; i++){
    alert('i++\n' + 'index: ' + i + '     value: ' + myArray[i]);
So, if you just want to iterate over all readable items of a array, regardless of their index: for(i in a) should also be ok.
Hope it's the truth ;-)

Similar Messages

  • Loop thru an array

    Hello,
    There are two text fields (employee and team). I want team to autopopulate based on employee using an array (I think this is the best way).
    textfieldA has 1 email in it (of 60 possible). I want textfieldB to autopopulate with another email (of 5 possible) based on the rawValue of textfieldA.
    My code is on a change event and looks like this (and does not work):
    var x;
    var 3dClos = new Array("[email protected]","[email protected]","[email protected]");
    if(email.rawValue = 3dClos[x]) {
        supemail.rawValue = "[email protected]";
        else
        supemail.rawValue = "";
    I do not want to make a giant if else statement as I have in the past - this is the perfect opportunity to learn the smart way to do it (even if it is not using an array). So in closing - check an email, see if it belongs to a tema and display that team email in another field.
    Can anybody help?

    Hi,
    Your approach correct but it is hard to read. Maybe with one more variable it will more understandable:
    var found = false;
    for  (var i=0; i<Carlos.length;i++ ){
         if(email.rawValue == Carlos[i]) {          supemail.rawValue
    = "[email protected]";  
              found
    = true;  
    if 
    (found == false){ 
         for (var i=0; i<Corey.length;i++ ){  
              if(email.rawValue == Corey[i]) {               supemail.rawValue
    = "[email protected]";  
                   found
    = true;  
    if 
    (found == false){ 
        for (var i=0; i<Ryan.length;i++ ){  
              if(email.rawValue == Ryan[i]) {               supemail.rawValue
    = [email protected];
                   found = true;  

  • Itunes wont let me download anything for my ipod touch.  everytime i try to it keeps looping thru to verify my account, so i do and then try to download and it loops me right back thru again to verify my account.  HELP ME PLEASE :(

    everytime i try to it keeps looping thru to verify my account, so i do and then try to download and it loops me right back thru again to verify my account.  HELP ME PLEASE

    Contact iTunes.  Select the appropriate topic of:
    Apple - Support - iTunes

  • Looping thru column names based on a variable value

    I have an ArrayCollection with a series of columns named
    price1, price2... thru to price10
    I'm trying to loop thru these columns based on a variable
    value, but can't figure the syntax:
    for (var column:int = 1; column < 11; column++){
    testPrice = myGrid.selectedItem.price(column); <-- this
    doesn't work
    }

    Try testPrice = myGrid.selectedItem["price" + column];
    Remember to test that selectedItem isn't null before you try
    to assign the values.
    TS

  • Looping through javabean array in jsp?

    Hello,
    In my servlet, I created an ArrayList of objects and pass these to a jsp page using:
    req.setAttribute("bean", uploadList);
    The ArrayList contains objects of the FileBean class, with a getIndex, and getDate methods.
    Could any possibly demonstrate how to loop through the ArrayList in the jsp and display the FileBean object values in a html table?
    To display the values of a javabean in jsp pages I normally have to use for example, requestScope.bean.getMethod();
    Thanks

    No, that would be requestScope.bean.attributename, if your getter method has the same name as the attribute you are getting.
    To loop through an array you have to use the c:forEach tag. Check google for "jstl foreach example", there are loads of examples.

  • Looping over an array avoiding scriptlets

    Hello,
    I want to loop over an array avoiding java scriptlets. Here is the code I would like to "clean".
    <%
    int rowCol=0;
    for(int i=0; i<countryArray.length; i++){
    rowCol++;
    Country country = (Country)countryArray;
    out.println("<tr " + ((rowCol%2==0)?("class=\"evenRow\""):("class=\"oddRow\"")) + ">");
    out.println("<td class=\"countryName\">" country.getName() "</td>");
    out.println("<td class=\"countryCapital\">" country.getCapital() "</td>");
    out.println("<td class=\"number\">" + country.getFormattedLandArea() + "</td>");
    out.println("<td class=\"number\">" country.getFormattedPopulation() "</td>");
    out.println("<td class=\"number\">" country.getFormattedGdp() "</td>");
    out.println("<td class=\"number\">" country.getFormattedGdp_per_head() "</td>");
    out.println("<td><a class=\"more\" href=\"pais.jsp?countryID=" + country.getId() + "\">m?s...</a></td>");
    out.println("</tr>");
    %>
    Can anyone give me some guidelines please?
    Thanks in advance,
    Julien.

    you mean this:
    <%
    int rowCol=0;
    for(int i=0; i<countryArray.length; i++){
      rowCol++;
      Country country = (Country)countryArray;
    %>
    <tr class="<%= rowCol%2==0? "evenRow" : "oddRow" %>">
    <td class="countryName"><%= country.getName() %></td>
    <td class="countryCapital"><%= country.getCapital() %></td>
    <td class="number"><%= country.getFormattedLandArea() %></td>
    <td class="number"><%= country.getFormattedPopulation() %></td>
    <td class="number"><%= country.getFormattedGdp() %></td>
    <td class="number"><%= country.getFormattedGdp_per_head() %></td>
    <td><a class="more" href="pais.jsp?countryID=<%= country.getId() %>">m?s...</a></td>
    </tr>
    <%
    %>

  • Looping thru tif images using OCR

    I have this code below in powershell where I OCR a tif image and save it to a table in sql server.  OCR is only working on the first page and not looping thru the tif image pages.
     Can someone help me with the code to make it loop on my tif image pages ?
     #Functions
    #OCR Function
    #param - imagepath(path the image to ocr)
    Function OCR($imagepath) {
        #create a new modi object
        $modidoc = new-object -comobject modi.document
        $modidoc.create($imagepath)
        try{
            #call the ocr method
            $modidoc.ocr()
            #single page document so I only need the item(0).layout text
            $modidoc.images.item(0).layout.text
        catch{
            #catch the error and go on
            return "Error"
        Finally
            #clean up the object
            $modidoc = ""
    } # end OCR function
    #Function to update the fulltext field in imageskeyvalues table
    #param ID(ID of table)
    function SaveImagesKeyValues($ID, $fulltext)
    $cmd = new-object system.data.sqlclient.sqlcommand
    $cmd.connection = $sqlconnection
    $s = "update dbo.Images_Local set fulltext = '" + ($fulltext.tostring()).replace('''','') + "' where ID = " + $ID.tostring() 
    $cmd.commandtext = $s
    $a = $cmd.executenonquery()
    } #end SaveImagesKeyValues
    #Function to get the list of records to OCR
    function GetImagesKeyValues()
    $sqlda = new-object system.data.sqlclient.sqldataadapter
    $datatable = new-object system.data.dataset
    $sqlcommandselect = new-object system.data.sqlclient.sqlcommand
    $sqlcommandselect.commandtext = 
        "select ID, FullImagePath, fulltext from images_Local  
    where (fulltext is null or fulltext like 'error%')  order by ID "
    #and (fulltext is null or fulltext like 'error%') 
    #"select b.batch_number, b.sequence_number,a.claimnumber, a.potentialamount,a.buyer, b.[document type],b.fulltext, c.imagelastmodified, c.image_path
    #from cip.dbo.cip_mastertable a 
    #inner join imageskeyvalues b on a.claimnumber = substring(b.[claim number],2,6) 
    #inner join images c on b.batch_number = c.batch_number and b.sequence_number = c.sequence_number
    #where (a.buyer = '006' or (a.buyer = '007' and a.potentialamount > 500000))
    #and c.imagelastmodified >= '1/1/13'
    #and b.[document type] = '2'
    #order by c.imagelastmodified"
    $sqlcommandselect.connection = $sqlconnection
    $sqlda.selectcommand = $sqlcommandselect
    #Fill the datatable and store the output in variable otherwise it shows in the output.
    $trap = $sqlda.fill($datatable)
    $datatable.tables[0]
    #end GetImagesKeyValues
    #End Functions
    #Main
    clear
    #set the parent path to the working directory
    $parentpath = "C:\Data\Portugal PRG\Images\Contratos SONAE 08-11\Imdex\"
    #Create new sql connection
    $sqlconnection = new-object system.data.sqlclient.sqlconnection
    #Assign the connectionstring 
    $sqlconnection.connectionstring = "Server=ATL01L20969\SQLEXPRESS;Database=Sonae;integrated security=True"
    #Open the connection
    $sqlconnection.open()
    #get the list of records that need ocr'd
    $imageskeyvalues = getimageskeyvalues
    #iterate through the list 
    foreach ($t in $imageskeyvalues){
    #$completepath = $parentpath + $t.image_path
    $completepath = $t.FullImagePath
    #call the ocr function and put the results in the fulltext property
    $t.fulltext = OCR $completepath
    #give some bread crumbs to monitor the script
    write-host  "Saving " $t.ID 
    #update the database fulltext filed
    Saveimageskeyvalues $t.ID $t.fulltext
    }#end Main

    Hi Abenitez,
    Since the OCR is only working on the first page, as a workaround, please try to spilt the tiff files to multople single files:Tiff Splitter, and then you can use foreach to loop every files.
    Refer to:
    How to split a multipage TIFF file on Windows?
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang

  • PL/SQL...Unsure how to loop thru multiple questions and display output?

    This is my first pl/sql program, I've written psudocode on paper, but not sure what to do for two parts.
    What I'm trying to do is write pl/sql that will check a row based on an employee id #.
    declare
    cursor cur is
    select *
    from employee
    where employee_id = foo;What we are checking are the results the employee answered. They have answered 180 questions and I want to find when the answer a 0, 7, and 9.
    Basically the pl/sql has to loop thru the 180 questions
    loop
    v_count := vcount + 1
    select *
    from employee
    where q1 thru q180 in (0, 7, 9);
    end loop;
    dbms_output.put_line ('Employee ID' || employee_id);
    dbms_output.put_line ('Q1 - Q180' || q1 - q180); I'm not sure how to write the pl/sql to loop thur all 180 questions.
    I'm not sure how to display the output to show what question they scored a 0, 7, and/or a 9 on.
    thanks
    Message was edited by:
    cmmiller

    536 columns in one table? Yowsa. Without a normalized table, you are going to need dynamic pl/sql and a messy solution.
    I would rethink your design, and come up with something more like so:
    employee
    questions
    employee_responses
    So that would you could easily do something like this:
    declare
      cursor c1 is
        select ers.question_id,
               que.question_name,
               ers.rating
          from employee emp,
               questions que,
               employee_responses ers
         where emp.employee_id = ers.employee_id and
               que.question_id = ers.question_id and
               emp.employee_id = v_employee_id and
               ers.rating in (0, 7, 9) and
               que.enabled_flag = 'Y';
    begin
      for r1 in c1 loop
        dbms_output.put_line('Question: '||r1.question_name);
        dbms_output.put_line('Employee Rated this: '||r1.rating);
      end loop;
    end;Thats how I would do it - I think you are going down the wrong path. What happens if you need to create a new question or delete one? You constantly have to modify the table. Hope this helps

  • PL/SQL how to loop thru SQL statement?

    Hey guys. I have this bit of a complicated problem.
    I have a cursor that selects a DISTINCT field called Term and a StudentID.
    I am looping thru that cursor.
    Inside that loop I have another SQL statement that is pulling all rows from the DB where the Term = the Term and the StudentID= the StudentID from the crusor loop.
    My problem is how do I get all the information/rows returned from that SQL statement? I need to loop thru it somehow, but I am not sure how to do it.
    If there is a better way to get this done feel free to chime in.
    Here is my code.
    /* CURSOR*/
    CURSOR c_GPAPerTerm IS
            SELECT DISTINCT Term, Student_ID FROM course_grades
            WHERE STUDENT_ID = p_StudentID;
                 /* OPEN AND LOOP THRU CURSOR*/
        OPEN c_GPAPerTerm;
        LOOP
        FETCH c_GPAPerTerm INTO v_Terms,v_StudentID;
                /* SQL STATEMENT NEED TO LOOP THRU AND GET VALUES FOR EACH ROW*/
                SELECT Score
                INTO v_Scores
                FROM course_grades
                WHERE Term = v_Terms and StudentID = v_StudentID;
        EXIT WHEN c_GPAPerTerm%NOTFOUND;
        END LOOP;
        CLOSE c_GPAPerTerm;

    Ok here's my complete code....it's pretty big though...hope it's not too confusing.
    It compiles fine if I take the new cursor out, so the error is somewhere in that cursor.
    CREATE OR REPLACE PROCEDURE get_Student_GPA(p_StudentID IN NUMBER) AS
         /*VARIABLES*/
         v_Terms VARCHAR2(6);
         v_Courses VARCHAR2(6);
         v_Scores NUMBER;
         v_Grade CHAR;
         v_GPA NUMBER;
         v_ScoresTotal NUMBER :=0;
         v_StudentID NUMBER;
         /*CURSORS*/
         CURSOR c_GetTerms IS
              SELECT Term
              FROM course_grades
              WHERE STUDENT_ID = p_StudentID;
         CURSOR c_GetCourseAndGrade IS
              SELECT Course_ID, Score FROM course_grades
              WHERE STUDENT_ID = p_StudentID;
         CURSOR c_GPAPerTerm IS
              SELECT DISTINCT Term, Student_ID
              FROM course_grades
              WHERE STUDENT_ID = p_StudentID;
         CURSOR c_GetScores (p_Term VARCHAR2, p_StudentID NUMBER) IS          
                   SELECT Score
                   FROM course_grades
                   WHERE Term = p_Term AND StudentID = p_StudentID;
         /*FUNCTIONS*/
         FUNCTION convert_grade(p_GradeNumber IN NUMBER)
              RETURN CHAR IS
         BEGIN
              /* GET NUMERIC GRADE AND CONVERT TO LETTER */
              CASE
                   WHEN p_GradeNumber < 60 THEN RETURN 'F';
                   WHEN (p_GradeNumber > 59  AND p_GradeNumber < 70) THEN  RETURN 'D';
                   WHEN (p_GradeNumber > 69  AND p_GradeNumber < 80) THEN  RETURN 'C';
                   WHEN (p_GradeNumber > 79  AND p_GradeNumber < 90) THEN  RETURN 'B';
                   WHEN (p_GradeNumber > 89  AND p_GradeNumber < 101) THEN RETURN 'A';
              ELSE    RETURN 'Z';
              END CASE;
         END convert_grade;
         FUNCTION calculate_gpa(p_TotalHourPoints IN NUMBER, p_TotalHours IN NUMBER)
              RETURN NUMBER IS
              /*CREATE VARIABLE TO HOLD GPA*/
              v_GPA NUMBER;
         BEGIN
              /*CALCULATE AND OUTPUT GPA*/
              v_GPA := p_TotalHourPoints/p_TotalHours;
              RETURN v_GPA;
         END calculate_gpa;
         FUNCTION calculate_point (p_Grade IN CHAR)
              RETURN NUMBER IS
         BEGIN
              /* GET LETTER GRADE AND CONVERT TO NUMBER */
              CASE
                   WHEN p_Grade = 'A' THEN RETURN 4;
                   WHEN p_Grade = 'B' THEN RETURN 3;
                   WHEN p_Grade = 'C' THEN RETURN 2;
                   WHEN p_Grade = 'D' THEN RETURN 1;
                   WHEN p_Grade = 'F' THEN RETURN 0;
              ELSE    RETURN 0;
              END CASE;
         END calculate_point ;
    /****BEGIN MAIN BLOCK********/
    BEGIN
         DBMS_OUTPUT.PUT_LINE('**********TERMS**********');
         OPEN c_GetTerms;
         LOOP
         FETCH c_GetTerms INTO v_Terms;
         DBMS_OUTPUT.PUT_LINE('Term: ' || v_Terms);
         EXIT WHEN c_GetTerms%NOTFOUND;
         END LOOP;
         CLOSE c_GetTerms;
         DBMS_OUTPUT.PUT_LINE('**********COURSES AND GRADES**********');
         OPEN c_GetCourseAndGrade;
         LOOP
         FETCH c_GetCourseAndGrade INTO v_Courses, v_Scores;
            v_Grade := convert_grade(v_Scores);
         DBMS_OUTPUT.PUT_LINE('Course: ' || v_Courses || '   Grade: ' || v_Grade);
         EXIT WHEN c_GetCourseAndGrade%NOTFOUND;
         END LOOP;
         CLOSE c_GetCourseAndGrade;
         DBMS_OUTPUT.PUT_LINE('**********GPA PER TERM**********');
         OPEN c_GPAPerTerm;
         LOOP
         FETCH c_GPAPerTerm INTO v_Terms,v_StudentID;
                      /*NEW CURSOR LOOP WILL GO HERE*/
                   v_ScoresTotal := v_ScoresTotal + v_Scores;
                      v_GPA := calculate_gpa(v_ScoresTotal, 3);
                   v_ScoresTotal :=0;
                   DBMS_OUTPUT.PUT_LINE('Term: ' || v_Terms || '   GPA: ' || v_GPA);
         EXIT WHEN c_GPAPerTerm%NOTFOUND;
         END LOOP;
         CLOSE c_GPAPerTerm;
    END get_Student_GPA;
    /

  • How to Loop thru a Queue?

    I have a Queue that I can add and remove items from, but I need to display all the contents currently in the Queue.
    How would I loop thru the Queue and do this?
    Any simple example will do.
    Thanks!

    Thanks for the link. It showed me which methods an Iterator has, but not practical way to use it. So I did some googling and found this example.
    import java.util.Iterator;
    import java.util.NoSuchElementException;
    for ( Iterator iter = myList.iterator(); iter.hasNext(); )
       String key = (String) iter.next();
       System.out.println( key );
       }Which makes perfect sense. However, where it says Iterator iter = myList.iterator(); I am not sure what to put in the myList.iterator(); part.
    I would assume that my Queue object would be used there, however, my Queue object has no .iterator() method.
    Like I said, I am new to Java so this is not as easy to me as it seems it should be.
    But there is all of my code if it helps.....I'll leave out the unimportant parts.
    Queenode class........................................
    public class QueueNode {
    //fields
    Object info;
    QueueNode link;
        public QueueNode() {
        public QueueNode(Object item) {
        info=item;
        link=null;
        public QueueNode(Object item, QueueNode qn) {
            info=item;
            link=qn;
    }//end classQueue class..............................................
    public class Queue {
       //create a front and back node
       private QueueNode front;
       private QueueNode rear;
       private int size;
       //methods
       public void insert(Object item){
          //if queue is empty front and rear are same
          if(isEmpty()){
              rear=new QueueNode(item);
              front = rear;
          }//end if
          //otherwise queue not empty add top end
          else{
              rear.link= new QueueNode(item);
              rear=rear.link;
          }//end else
          ///either case incriment size
          size++;
       }//end insert
       public Object remove(){
           //create a temp node referencing the front
           QueueNode oldFront=front;
           //peek at front item
           Object item = peek();
           //make front to link with the next node
           front=front.link;
           //remove temp node
           oldFront=null;
           //decrement size
           size--;
           //return the item that was removed
           return item;
       }//remove
       public Object peek(){
           if(isEmpty()){
               throw new NullPointerException();
           }//end if
           else{
               return front.info;
           }//and else
       }//end peek
       public boolean isEmpty(){
           return(size==0);
       }//end isEmpty
       public int getSize(){
           return size;
       }//end getsize
    }//end classAnd finaly my class to test that the Queue is working....................
    import javax.swing.*;
    import javax.swing.border.BevelBorder;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Iterator;
    import java.util.NoSuchElementException;
    public class QueueTest extends JFrame implements ActionListener{
        //Create Queue object
        Queue q = new Queue();
       public QueueTest(){
            //Add title to window
            super("Testing Queue's");
         }//end constructor
        public void actionPerformed(ActionEvent event){
            if (event.getSource()==btnAddQueueItem){
                q.insert(txtAddQueueItem.getText());
                for(Iterator iter = q.?????; iter.hasNext();){
                    ///Output each queue item here........
                }//end for
            }//end if
             if (event.getSource()==btnRemoveQueueItem){
                 q.remove();
             }//end if
        }//end actionPerformed
        public static void main(String[] args) {
        QueueTest testQueue = new QueueTest();
        }//end main
    }//end class

  • How to Loop thru a RFC model

    how to Loop thru the RFC model
    for(int i=0;i<wdContext.nodeEx_Org_Units().size();i++){
    //how to get the attribute each and every columns
      //mgr.reportSuccess("id" +nodeEx_Org_Units().getId());
    Message was edited by:
            yzme yzme

    Hi,
    When there is a RFC Model with table ouptut....every row in the table can be correlated to elements in the model node...
    your model node : <i>nodeEx_Org_Units</i>
    Now if you have 5 rows as output after executing the model...there will be 5 elements created under the node. Loop through all the elements and use the get methods as given below:
    // assuming tht u have two columns(attributes) <i>col1 & col2</i>
    // access the node
    IPrivate<view>.IEx_Org_UnitsNode tableNode = wdContext.nodeEx_Org_Units();
    // access the element under the node, do not initalize this element
    IPrivate<view>.IwdContext.nodeEx_Org_UnitsElement tableElem;
    //loop thrugh the elements
    for(int i=0; i<tableNode.size(); i++)
       tableElem = tableNode.getEx_Org_UnitsElementAt(i);
       // access the attributes col1 & col2
       tableElem.getCol1();
       tableElem.getCol2();
    Regards
    Srikanth

  • Looping through an array to pass out the variable to Scanner

    I'm trying to get an array of files which end .list in a particular directory and then scan each one for an email address and at the moment print it out. As I understand it Scanner doesn't read from File but will from a String. However each time I try putting it into a String, I get an error as the code tries to pass the full array to it rather than the file names.
    What would be the best way of looping through the array so that each time Scanner gets a new path name applied to it?
    import java.io.*;
    import java.util.Arrays;
    import java.util.Scanner;
    import java.util.regex.*;
    import java.io.File;
    public class FindEmail {
         public static void main(String[] args) throws IOException {
              File userDir = new File("M:\\foo\\bar");
            FileFilter listfilter = new fileFinder();
            File[] foundarray = userDir.listFiles(listfilter);
            for (File i: foundarray) {
              Scanner s = new Scanner(new File(foundarray));
            try {
            Pattern p = Pattern.compile("([\\w+|\\.?]+)\\w+@([\\w+|\\.?]+)\\.(\\w{2,8}\\w?)");
            String str = null;
                 while ( (str = s.findWithinHorizon(p, 0)) != null ){
                     System.out.println(str);
            } finally {
               if (s != null) {
                  s.close();
                }//if
            }//finally
            }//for
         } //main
    }//class
    //class to find the list files
    class fileFinder implements FileFilter {
        public boolean accept(File file) {
            return file.getName().toLowerCase().endsWith(".list");
    }

    The error that I got was
    Exception in thread "main" java.io.FileNotFoundException: [M:\foo\MAIN\BEDEWORK.LIST, M:\foo\MAIN\BEDEWORKSPRIVATE.LIST, M:\foo\MAIN\DONNA-NEW.LIST, M:\foo\MAIN\DONNA-NEWER.LIST, M:\foo\MAIN\DONNA-TEST.LIST] (The filename, directory name, or volume label syntax is incorrect)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.util.Scanner.<init>(Unknown Source)
    at org.stfc.bedework.FindEmail.main(FindEmail.java:17)At the time I had the code:
    FileFilter listfilter = new fileFinder();
               File[] foundarray = userDir.listFiles(listfilter);
               String name = Arrays.toString(foundarray);
               for (int i=0; i<name.length(); i++) {
              Scanner s = new Scanner(new File(name));

  • LOOPING THRU LINE ITEM

    HI IAM TRYING TO VALIDATE  FIRST CHECKING WHTETHER THE BILLING PLAN IS AT THE HEADER LEVEL OR AT THE ITEM LEVEL.
    HOW CAN I LOOP THRU ALL THE ITEMS IF THE BILLING PLAN IS AT THE ITEM LAVEL I NEED TO LOOP THRU ALLL THE ITEMS!!SOME OF THEM MAY HAVE BILLING PLAN AT THE ITEM LEVEL AND SOME AT THE HEADER LEVEL.
    PLSS TELL ME HOW TO DO IT FOR THE ITEM LEVEL.
    POINTS PROMISED!!

    i have done the code this way will it work???
    TYPES: BEGIN OF gst_fpla,
            fplnr TYPE fpla-fplnr,
            vbeln TYPE fpla-vbeln,
            rfpln TYPE fpla-rfpln,
            END OF gst_fpla.
      TYPES: BEGIN OF gst_fplt,
            fplnr TYPE fplt-fplnr,
            fproz TYPE fplt-fproz,
            fareg TYPE fplt-fareg,
            END OF gst_fplt.
    TYPES: BEGIN OF gst_fplt1,
           fplnr type fplt-fplnr,
           end of gst_fplt1.
      DATA: gi_fpla TYPE STANDARD TABLE OF gst_fpla.
      DATA: gi_fplt TYPE STANDARD TABLE OF gst_fplt.
      DATA: gw_fpla TYPE gst_fpla.
      DATA: VAR1(1) TYPE C.
      DATA: VAR2(9) TYPE C.
      DATA: GW_XFPLA LIKE XFPLA.
      DATA: gw_fplt TYPE gst_fplt.
      TYPES: BEGIN OF GST_RFPLN,
              RFPLN TYPE FPLA-RFPLN,
            END OF GST_RFPLN.
    DATA: GI_RFPLN TYPE STANDARD TABLE OF GST_RFPLN.
    DATA: GW_RFPLN TYPE GST_RFPLN.
    data: gi_fplt1 type standard table of gst_fplt1.
    data: gw_fplt1 type gst_fplt1.
      IF ( sy-tcode = 'VA01' OR sy-tcode = 'VA02' OR sy-tcode = 'VA21' OR  sy-tcode = 'VA22' ) AND ( vbak-auart = 'ZQT' OR vbak-auart = 'ZNS' ).
    IF RV45A-KFREL = 'X'.
      IF XFPLA[] IS NOT INITIAL.
      LOOP AT XFPLA INTO GW_XFPLA.
      GW_RFPLN-RFPLN = GW_XFPLA-RFPLN.
      APPEND GW_RFPLN TO GI_RFPLN.
      ENDLOOP.
    SPLIT GW_XFPLA-RFPLN AT '$' INTO VAR1 VAR2.
    DATA: BEGIN OF MRFPLN,
              rfpln1 type c length 1 value '0' ,
              rfpln2 type c length 9 value '',
              end of MRFPLN.
          MRFPLN-rfpln2 = VAR2.
    DATA: RFPLN TYPE STRING.
      RFPLN = MRFPLN.
    CONDENSE RFPLN.
      SELECT fplnr vbeln rfpln FROM FPLA INTO TABLE gi_fpla  FOR ALL  ENTRIES IN GI_RFPLN WHERE fplnr = GI_RFPLN-RFPLN.
    ENDIF.
      loop at gi_fpla into gw_fpla.
      if gw_fpla-vbeln = '' and gw_fpla-rfpln = ''.
      READ TABLE xfpla WITH KEY rfpln = gw_fpla-fplnr.
      if sy-subrc NE 0.
      MESSAGE  W047(YD01).
      write:'invalid reference number'.
      else.
      gw_fplt1-fplnr = gw_fpla-fplnr.
      append gw_fplt1 to gi_fplt1.
        ENDIF.
        ENDIF.
        ENDLOOP.
      ENDIF.
      SELECT fplnr fproz fareg from fplt into  TABLE GI_FPLT for all entries in gi_fplt1 where fplnr = gi_fplt1-fplnr.
      LOOP AT GI_FPLT INTO GW_FPLT.
      READ TABLE XFPLT WITH KEY FAREG = gw_fplt-fareg.
      if sy-subrc NE 0.
      WRITE:'BILLING RULE IS INVALID'.
      ELSE.
    WRITE:'CORRECT BILLING RULE'.
      READ TABLE XFPLT WITH KEY FPROZ = gw_fplt-fproz.
      if sy-subrc ne 0.
      write: 'billing percentage is invalid'.
      else.
      write: 'valid billing percentage'.
      endif.
      ENDIF.
      ENDLOOP.
    ELSE.                                                "ELSE FOR RV45A
    CLEAR: GI_FPLA.
    CLEAR: GI_FPLT.
    CLEAR: GI_RFPLN.
    CLEAR: GI_FPLT1.
    REFRESH: GI_FPLA.
    REFRESH: GI_FPLT.
    REFRESH: GI_RFPLN.
    REFRESH: GI_FPLT1.
    do the validations for item level.
      ENDIF.                                                "for  rv45a-if.
      ENDIF.

  • Looping thru instance manager and checking radio button selected

    I need to loop thru my instances and toggle visible/hidden if a particular radio button in each instance is selected.
    My code right now does not work but I feel I am on the right track (minus the else statement it will need to toggle on/off).
    Can anyone help? thanks in advance!
    var rowCount = BugGroup_f.instanceManager.count;
    for (i=0; i<rowCount; i++) {
    var str = xfa.resolveNode("BugGroup_f.detail3.bugInfo.BugItem.status.RadioButtonList[" + i + "]").rawValue;
        if (str.indexOf("Fixed") > -1) {
        xfa.resolveNode("BugGroup_f["+rowCount+"]").presence = "hidden"

    So we've got a set of Rows, each with a subitem called RadioToggle, and you want to go through and set them all, then click a separate button and hide the ones with "on" radio buttons?
    function ToggleRows(reset){
         var Rows = Form.subform....BugGroup_f.all;
         var curRow;
         for (var i=0; i<Rows.length; i++){
              curRow = Rows.item(i);
              if ((curRow.RadioButton.rawValue == "WhatevermeansHidden") && !reset){
                   curRow.presense = "hidden";}
              else{
                   curRow.presense = "visible";}
    ^ in a script object, and put
    scriptObjectName.ToggleRows(reset);
    in the click event of your button, and you should be golden.
    If you do want them to hide the moment you click the toggle, you could put this, right?
    if (xfa.event.newText == "whatevermeansoff"){
         parent....presense = "hidden";}
    The .all method seems like a much easier way to handle collections of objects, and specificaly collections of instances. It also means you can do relative referencing, i.e. to create a function that will operate on all the rows of a table, without knowing which table it is operating on, so a button in each table can pass it's parent table to the function.
    var GroupVariable = Object.all
    for(var i=0; i < GroupVariable.length; i++)
    EDIT:
    add a reset value, and pass it in to your function like above (added).
    make a separate button, or control, that will call the function with reset = 1.

  • Looping thru enumeration objects

    How to loop thru the enumeration objects?? Thanks.

    If you are using JAVA 5.0 enum, here is an example:
    public class Example
        public enum Season { WINTER, SPRING, SUMMER, FALL }
        public static void main(String[] args)
            for (Season s : Season.values())
                System.out.println(s);
    }

Maybe you are looking for

  • How to create and use templete or standard network / activity and wbs

    dear i have define the structure for my project which have WBS elements, network and activties. the strucutre is same for all the projects that i define. i wanna know whether to use templete or standard wbs network and activities as templete for the

  • How do I change the font color in Live Type?

    How can I change the font color in Live Type?

  • Creative Vision:M 60 GB prob

    I got my Vision:M back in January and it's been working great... until a few days ago. For the past week, it's been taking longer to load (though I only have 30 GB filled) and it's been freezing a lot (that's only happened once or twice before). Now

  • Should I choose the source?

    Good day Dude, I am to set up OL 5.8 in the VM. Should I proceed to choose V31121-01.iso which is the source, during setting up the virtual disk image inside the VM? Download Oracle Linux Release 5 Update 8 for x86_64 (64 Bit) V31120-01 3.7G Download

  • Standard BAPI/RFC for customer specific pricing

    Hi all, We have a requirement for getting the customer specific pricing for a product. .We have few customers who are privelaged of procuring materials at a lesser price than others.We need a procedure or functionality that will pick this discounted