JDev 10.1.3.4: How to properly loop through the rows of a VO?

Hi,
This is a newbie question. Using JDeveloper 10.1.3.4 I am trying to loop through the rows of a view object. I am sure that the VO returns the following rows in that order:
200809
200902
200906If I use this code (where termsOpen is the VO instance):
while (termsOpen.hasNext()) {
   System.out.println(termsOpen.getCurrentRow().getAttribute("Term"));
}it proves to be an endless loop and I get "200809" printed on the console endlessly. The API says that hasNext() "does not move the current row". A book says that the pointer initially is at row 0. I wonder why it prints the first row. So the code is changed to:
while (termsOpen.hasNext()) {
   Row currRow = termsOpen.next();
   System.out.println(currRow.getAttribute("Term"));
}But now I get only the last two rows printed on the console, and do not get to see the first row:
200902
200906What's wrong?
Thanks for helping!
Newman

Hi, Branislav,
Thank you for the suggestion.
I tried that also. When the code is
while (termsOpen.hasNext()) {
   System.out.println(termsOpen.getCurrentRow().getAttribute("Term"));
   termsOpen.next();
}I get only the first two rows and last row is dropped:
200809
200902To get all the three row, I end up using this code:
System.out.println(termsOpen.first().getAttribute("Term"));
while (termsOpen.hasNext()) {
   Row currRow = termsOpen.next();
   System.out.println(currRow.getAttribute("Term"));
}But that shouldn't be the way of doing the work. If I use a block of 50 lines of code to process each row, the code will have to be written once before the while loop and another time inside the while loop.
The book which says that the pointer starts at the row slot before the first row is found on the internet, on p.469. It makes sense to me that the pointer starts at row 0. But unfortunately the actual copy of JDev 10.1.3.4 I am using behaves otherwise.
Newman

Similar Messages

  • Multi-record block (how do I loop through the block)

    I created a two canvas form. On the first canvas, the user enters data and selects 1 - 30
    reports that they want to run. When they click on <NEXT> button, I create a multi-record
    control block and display each record on the second screen using
    go_block;
    clear_block;
    move data;
    create_record;
    The user then selects on the second canvas which reports to run now and which to run later via
    a LOV. When they press the <RUN> button, I want to start at the first record and either run the
    report or schedule it. Then I want to move onto the second and the third until all selected reports
    have been handled. I know I should use a loop but can't seem to make it work.
    So my question is, How do I loop through the records in a multi-record control block, pass the information
    for that one record to a parameter form and then execute the request? Each control block record contains
    10 parameter fields.
    Thanks.
    Bob

    go_record(1);
    << do your processing >> -- This is executed only for the first record.
    if :system.last_record = 'TRUE' then -- If the 1st record is also the last record.
    RETURN;
    end if;
    LOOP
    next_record;
    << do your processing >>
    if :system.last_record = 'TRUE' then
    EXIT;
    end if;
    END LOOP;
    I created a two canvas form. On the first canvas, the user enters data and selects 1 - 30
    reports that they want to run. When they click on <NEXT> button, I create a multi-record
    control block and display each record on the second screen using
    go_block;
    clear_block;
    move data;
    create_record;
    The user then selects on the second canvas which reports to run now and which to run later via
    a LOV. When they press the <RUN> button, I want to start at the first record and either run the
    report or schedule it. Then I want to move onto the second and the third until all selected reports
    have been handled. I know I should use a loop but can't seem to make it work.
    So my question is, How do I loop through the records in a multi-record control block, pass the information
    for that one record to a parameter form and then execute the request? Each control block record contains
    10 parameter fields.
    Thanks.
    Bob

  • How do I: Loop through Application objects

    How would I loop through the application object?  My goal is to see if the object is a label and change its font size.
    pseudocode would look like this:
    function setsize(change int) {
      for each obj in application {
        if obj is of type label {
          set font size to font size + change
    Once I got that working, I'd add other objects that display text.  The "change" would be a number to increase (positive) or decrease (negative) the size.
    Thanks,
    Jerry

    I have this:
              <mx:HBox id="resultTextBox"
                  width="100%"
                  verticalScrollPolicy="off" horizontalScrollPolicy="auto">
                  <mx:Label id="resultPotentialResultsLabel"
                      text="Food Stamp potential eligibility for household, estimated monthly benefit amount "
                      styleName="textNormal"
                      toolTip="Results message"
                      tabIndex="200" tabEnabled="true"  fontSize="40"/>
                  <mx:Text id="resultPotentialResultsData"
                      styleName="resultNumberNormal"
                      toolTip="Final results"
                      tabIndex="202" tabEnabled="true" />
              </mx:HBox>
    When I expand the font size it pushes the "resultPotentialResutsData" to limbo.  I tried adding the horizonal scroll bar to allow the user to still see the results,  The scroll doesn't appear.
    1) is there a way to get the box to expand to fix the content?
    2) is there a way to get the scroll bar to appear when needed?
    3) is there a way to wrap the text (in this case the second field) in the HBox?

  • How to properly back up the iPhone (I clearly did it wrong)

    I backed up my iPhone, named it and then restored it to the factory settings. When I went back and right clicked on the phone to "restore from backup", the backup I had just made was not there. Only a backup from September. Now, I've lost everything since September, that was on my phone. I was wondering what I did wrong and how to properly back up the iPhone for future reference. Does it only save 2 backups? I just am not sure why it didn't save my most recent backup, and rather, saved one from September. Sad, I lost a lot of important texts, numbers, notes and pictures. Thanks for any help!

    From iTunes, File > Transfer Purchases

  • How do I Loop through a recordset using PHP

    I have a recordset containing a MySql table with 5 columns, each one containing an email address of an official in a club.
    Each row represents a different club, and each column a different type of official.
    The first column represents chairmen, the next treasurers etc...
    The recordset is called $mailset.
    I need to loop through each row of $mailset and extract the email addresses of each column and concatenate them into a string seperated by semi colons ; so it ends up like this:
    [email protected];[email protected];[email protected]; and so on.
    This is how the recordset is set up:
    mysql_select_db($database_dummyread, $dummyread);
    $query_mailset = "SELECT club_chair_email, club_treas_email, club_sec_email, club_delegate_email, club_deputy_email FROM clubs";
    $mailset = mysql_query($query_mailset, $dummyread) or die(mysql_error());
    $row_mailset = mysql_fetch_assoc($mailset);
    $totalRows_mailset = mysql_num_rows($mailset);
    ?>
    I tried using a  loop to step through the recordset, but it always shows the first record, so its not moving the pointer through the file.
    The pseudo code aught to be something like this:
    Initialise variables and move to the first record
    If there are records to process
                   Read a record
                        Process all columns
                Move on to the next record
    else
         if there are no records
              print an error message
    else
    Print the results.
    Can anyone give me a hint as to how to move from row to row in a recordeset under the control of a loop.
    I am using PHP and MySql. (as far as I know, it is the original - not PDO or MySqli)

    Each call to mysql_fetch_assoc($mailset) retrieves the value at the current location and increments the pointer in the recordset array. So use either a do or while loop and call mysql_fetch_assoc($mailset) from within the loop.
    From the docs:
    Returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead. mysql_fetch_assoc() is equivalent to calling mysql_fetch_array() with MYSQL_ASSOC for the optional second parameter. It only returns an associative array.

  • How to download firework through the adobe assistant

    how to download firework through the adobe assistant

    You should be able to add the download to the Adobe Download Assistant by choosing the download option at http://www.adobe.com/cfusion/tdrc/index.cfm?product=fireworks.

  • Command how many mails when through the mailstore for a specific domain.

    I need to get info from the maillog to see how many mails when through the mailstore for a specific domain.
    For example all the mails send and received by example.com witch is hosted on that 2005q1 mailserver.
    Anyone know the commands to get it out.

    The data is certainly in the mail.log.
    You may want to start with the perl log parsing script, here:
    http://ims.balius.com/resources/downloads/files/imslog.pl

  • How to loop through the "On My Mac" folders in mail?

    Hi there - i am new to applescript, but am slowly working out how to use it.
    I am stumped on how to write a rule that will move a message to a folder identified by a tag in a message (I am using MailTags).
    I have script that will take the first tag and move the message to a mail folder in a fixed location (e.g. Archive/<tag name>) however I wanted to make it more generic by looping over all of my mail folders and finding one that matched the tag name.
    However I am stumped on how to loop over all of my mail folder names - I have tried:
    repeat with aFolder in (every mailbox of (mailbox for "ON MY MAC"))
    and
    repeat with aFolder in every mailbox of inbox
    etc.
    but none of these seem to work.
    Is there some magic syntax to do this, so that I can do:
    if (name of aFolder = msgTag) then
    move oneMessage to mailbox (name of aFolder)
    end if
    Tim

    You don't necessarily need to assign a variable to the entire list in order to loop through them (unless you really want to) - for example:
    tell application "Mail" to repeat with aFolder in (get mailboxes)
            -- do stuff with aFolder
    end repeat
    There are several AppleScript resources, but the main ones I use are:
    AppleScript Language Guide
    AppleScript Tutorials at MacScripter.net

  • How to hide or make the row invisible in RTF report?

    Hi ,
    I am setting a flag = 'Y' in one condition as i want to display records only if flag = 'Y'. It is not displaying data in case flag != 'Y'.But it is displaying empty row in report for the record which does not have flag = ' Y'. How to hide those empty rows?
    See following code for example:
    <?for-each: LIST_G_STORE_ID/G_STORE_ID?>
    <?xdofx: if STORE_ID = '' then '-' else STORE_ID?>
    <?for-each: LIST_G_TRANSACTION/G_TRANSACTION?>
    <?for-each: Q1?><?if: PLAN_CODE = 'PLN'?><?xdoxslt:set_variable($_XDOCTX,'flag', 'Y')?><?end if?><?end for-each?>
    <?if: xdoxslt: get_variable($_XDOCTX,'flag') = 'Y'?><?xdofx: if TRN_DATE = '' then '-' else TRN_DATE?><?end if?>
    <?for-each@inlines:LIST_Q1/Q1?>
    <?if: xdoxslt: get_variable($_XDOCTX,'flag') = 'Y'?><?xdofx: if INVC_NUM= '' then '-' else INVC_NUM?><?end if?>
    <?for-each@inlines:LIST_Q1/Q1?><?if: xdoxslt: get_variable($_XDOCTX,'flag') = 'Y'?><?xdofx: if substr(PLAN_CODE,1,3) != 'PLN' then PRODUCT_CODE?><?xdofx: if PLAN_CODE!= 'PLN' then ','?><?end if?><?end for-each?>
    <?end for-each?><?xdoxslt:set_variable($_XDOCTX,'flag','N')?>
    <?end for-each?>
    <?end for-each?>
    please advice or let me know if more detail is needed.
    Thanks in Advance!!

    <?for-each:LIST_G_STORE_ID/G_STORE_ID [PLAN_CODE ='PLN' ]?> will only show the rows where that value of xml field PLAN_CODE is equal to 'PLN'.
    Hope this helps
    Domnic
    Edited by: Domnic_JDE_BIP on Apr 12, 2010 5:47 PM

  • How to exit Loop in the middle

    I have a requirement of exiting a loop in between, if a particular condition is satisfied. How do i achieve this in workflow? I thought of using 'Process Control' but it has no option to exit a loop from the middle....is there a way out?

    Hi,
    Loop runs until a condition is met.
    So to exit a loop you need to set a condition as false at a step and then it would exit.
    To do so, you can set a flag value in the loop processing. When ever the flag is initial keep on processing the loop and when you want the loop to exit, just set the value of the flag.
    Hope this helps!
    Regards,
    Saumya

  • How Do I get SSIS To Stop Looping Through Excel Rows After Last Populated Record?

    I have a package that loops through many excel files. Each Excel File has about 5000 rows. My problem is that after the 5000th row SSIS keeps looping through all the rows after the last row. There are nothing in these rows. This is a complete bottleneck
    of my package because it takes forever when doing this. How do I stop this?
    Thanks

    Another way is to specify the range in select statement which can be done in two ways
    http://getsetsql.blogspot.in/2012/01/using-ssis-load-data-to-excel-sheet-at.html
    http://sqlserversolutions.blogspot.in/2009/02/selecting-excel-range-in-ssis.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Can you please explain how this query is fetching the rows?

    here is a query to find the top 3 salaries. But the thing is that i am now able to understand how its working to get the correct data :How the data in the alias table P1 and P2 getting compared. Can you please explain in some steps.
    SELECT MIN(P1.SAL) FROM PSAL P1, PSAL P2
    WHERE P1.SAL >= P2.SAL
    GROUP BY P2.SAL
    HAVING COUNT (DISTINCT P1.SAL) <=3 ;
    here is the data i used :
    SQL> select * from psal;
    NAME SAL
    able 1000
    baker 900
    charles 900
    delta 800
    eddy 700
    fred 700
    george 700
    george 700
    Regards,
    Renu

    ... Please help me in understanding the query.
    Your query looks like anything but a Top-N query.
    If you run it in steps and analyze the output at the end of each step, then you should be able to understand what it does.
    Given below is some brief information on the same:
    test@ora>
    test@ora> --
    test@ora> -- Query 1 - using the non-equi (theta) join
    test@ora> --
    test@ora> with psal as (
      2    select 'able' as name, 1000 as sal from dual union all
      3    select 'baker',   900 from dual union all
      4    select 'charles', 900 from dual union all
      5    select 'delta',   800 from dual union all
      6    select 'eddy',    700 from dual union all
      7    select 'fred',    700 from dual union all
      8    select 'george',  700 from dual union all
      9    select 'george',  700 from dual)
    10  --
    11  SELECT p1.sal AS p1_sal, p1.NAME AS p1_name, p2.sal AS p2_sal,
    12         p2.NAME AS p2_name
    13    FROM psal p1, psal p2
    14   WHERE p1.sal >= p2.sal;
        P1_SAL P1_NAME     P2_SAL P2_NAME
          1000 able          1000 able
          1000 able           900 baker
          1000 able           900 charles
          1000 able           800 delta
          1000 able           700 eddy
          1000 able           700 fred
          1000 able           700 george
          1000 able           700 george
           900 baker          900 baker
           900 baker          900 charles
           900 baker          800 delta
           900 baker          700 eddy
           900 baker          700 fred
           900 baker          700 george
           900 baker          700 george
           900 charles        900 baker
           900 charles        900 charles
           900 charles        800 delta
           900 charles        700 eddy
           900 charles        700 fred
           900 charles        700 george
           900 charles        700 george
           800 delta          800 delta
           800 delta          700 eddy
           800 delta          700 fred
           800 delta          700 george
           800 delta          700 george
           700 eddy           700 eddy
           700 eddy           700 fred
           700 eddy           700 george
           700 eddy           700 george
           700 fred           700 eddy
           700 fred           700 fred
           700 fred           700 george
           700 fred           700 george
           700 george         700 eddy
           700 george         700 fred
           700 george         700 george
           700 george         700 george
           700 george         700 eddy
           700 george         700 fred
           700 george         700 george
           700 george         700 george
    43 rows selected.
    test@ora>
    test@ora>This query joins PSAL with itself using a non equi-join. Take each row of PSAL p1 and see how it compares with PSAL p2. You'll see that:
    - Row 1 with sal 1000 is >= to all sal values of p2, so it occurs 8 times
    - Row 2 with sal 900 is >= to 9 sal values of p2, so it occurs 7 times
    - Row 3: 7 times again... and so on.
    - So, total no. of rows are: 8 + 7 + 7 + 5 + 4 + 4 + 4 + 4 = 43
    test@ora>
    test@ora> --
    test@ora> -- Query 2 - add the GROUP BY
    test@ora> --
    test@ora> with psal as (
      2    select 'able' as name, 1000 as sal from dual union all
      3    select 'baker',   900 from dual union all
      4    select 'charles', 900 from dual union all
      5    select 'delta',   800 from dual union all
      6    select 'eddy',    700 from dual union all
      7    select 'fred',    700 from dual union all
      8    select 'george',  700 from dual union all
      9    select 'george',  700 from dual)
    10  --
    11  SELECT p2.sal AS p2_sal,
    12         COUNT(*) as cnt,
    13         COUNT(p1.sal) as cnt_p1_sal,
    14         COUNT(DISTINCT p1.sal) as cnt_dist_p1_sal,
    15         MIN(p1.sal) as min_p1_sal,
    16         MAX(p1.sal) as max_p1_sal
    17    FROM psal p1, psal p2
    18   WHERE p1.sal >= p2.sal
    19  GROUP BY p2.sal;
        P2_SAL        CNT CNT_P1_SAL CNT_DIST_P1_SAL MIN_P1_SAL MAX_P1_SAL
           700         32         32               4        700       1000
           800          4          4               3        800       1000
           900          6          6               2        900       1000
          1000          1          1               1       1000       1000
    test@ora>
    test@ora>Now, if you group by p2.sal in the output of query 1, and check the number of distinct p1.sal, min of p1.sal etc. you see that for p2.sal values - 800, 900 and 1000, there are 3 or less p1.sal values associated.
    So, the last 3 rows are the ones you are interested in, essentially. As follows:
    test@ora>
    test@ora> --
    test@ora> -- Query 3 - GROUP BY and HAVING
    test@ora> --
    test@ora> with psal as (
      2    select 'able' as name, 1000 as sal from dual union all
      3    select 'baker',   900 from dual union all
      4    select 'charles', 900 from dual union all
      5    select 'delta',   800 from dual union all
      6    select 'eddy',    700 from dual union all
      7    select 'fred',    700 from dual union all
      8    select 'george',  700 from dual union all
      9    select 'george',  700 from dual)
    10  --
    11  SELECT p2.sal AS p2_sal,
    12         COUNT(*) as cnt,
    13         COUNT(p1.sal) as cnt_p1_sal,
    14         COUNT(DISTINCT p1.sal) as cnt_dist_p1_sal,
    15         MIN(p1.sal) as min_p1_sal,
    16         MAX(p1.sal) as max_p1_sal
    17    FROM psal p1, psal p2
    18   WHERE p1.sal >= p2.sal
    19  GROUP BY p2.sal
    20  HAVING COUNT(DISTINCT p1.sal) <= 3;
        P2_SAL        CNT CNT_P1_SAL CNT_DIST_P1_SAL MIN_P1_SAL MAX_P1_SAL
           800          4          4               3        800       1000
           900          6          6               2        900       1000
          1000          1          1               1       1000       1000
    test@ora>
    test@ora>
    test@ora>That's what you are doing in that query.
    The thing is - in order to find out Top-N values, you simply need to scan that one table PSAL. So, joining it to itself is not necessary.
    A much simpler query is as follows:
    test@ora>
    test@ora>
    test@ora> --
    test@ora> -- Top-3 salaries - distinct or not; using ROWNUM on ORDER BY
    test@ora> --
    test@ora> with psal as (
      2    select 'able' as name, 1000 as sal from dual union all
      3    select 'baker',   900 from dual union all
      4    select 'charles', 900 from dual union all
      5    select 'delta',   800 from dual union all
      6    select 'eddy',    700 from dual union all
      7    select 'fred',    700 from dual union all
      8    select 'george',  700 from dual union all
      9    select 'george',  700 from dual)
    10  --
    11  SELECT sal
    12  FROM (
    13    SELECT sal
    14      FROM psal
    15    ORDER BY sal DESC
    16  )
    17  WHERE rownum <= 3;
           SAL
          1000
           900
           900
    test@ora>
    test@ora>
    test@ora>And for Top-3 distinct salaries:
    test@ora>
    test@ora> --
    test@ora> -- Top-3 DISTINCT salaries; using ROWNUM on ORDER BY on DISTINCT
    test@ora> --
    test@ora> with psal as (
      2    select 'able' as name, 1000 as sal from dual union all
      3    select 'baker',   900 from dual union all
      4    select 'charles', 900 from dual union all
      5    select 'delta',   800 from dual union all
      6    select 'eddy',    700 from dual union all
      7    select 'fred',    700 from dual union all
      8    select 'george',  700 from dual union all
      9    select 'george',  700 from dual)
    10  --
    11  SELECT sal
    12  FROM (
    13    SELECT DISTINCT sal
    14      FROM psal
    15    ORDER BY sal DESC
    16  )
    17  WHERE rownum <= 3;
           SAL
          1000
           900
           800
    test@ora>
    test@ora>
    test@ora>You may also want to check out the RANK and DENSE_RANK analytic functions.
    RANK:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions123.htm#SQLRF00690
    DENSE_RANK:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions043.htm#SQLRF00633
    HTH
    isotope

  • How to purchase "Movies" through the Canadian iTune store?

    Could some one please tell me how to purchase a "movie" through the Canadian iTunes store?
    The "Movies" icon only available in the United States iTune store. I tried to set up an account through this US store but was unable due to "no option" for Canadian address.
    Back to Canadian iTune store page, but there are no "movies" available for purchase and download.
    Please help.

    At present movies are only available in the US iTunes store. There are a variety of reasons for this including copyright and licensing issues in different countries.
    You cannot purchase anything from an iTunes store outside of the country in which you live as mentioned in the Terms of Sale.
    "You agree not to use or attempt to use the Service from outside of the available territory, and that iTunes may use technologies to verify your compliance."
    The Terms of Use for the iTMS state that you agree that you won't attempt to make purchases from outside the store's country. The chance is small that Apple will cut off your account, but just be aware that it is possible. They certainly won't support your use of the US iTMS from Canada if you do have any problems.

  • How's Light Going Through The Wireless Keyboard Aluminum Body?

    Hi. It's nice how they designed the wireless keyboard. If you switch on the power button, you'll see the light coming through the alluminum body but there are no holes in there. How'd they do that?:) It's nice to see things like this from Apple's designers. I wished it was flatter though and the battery case would just be on top or middle. Gbu.

    If you take a very close look at the keyboard you'll see that there micro holes in the casing.
    afaik a laser is used to punch that holes.

  • How to properly drain & calibrate the battery?

    I have a dual-usb ibook g3 (500Mhz), and I'm trying to fully drain the battery to calibrate it (right now it runs for about 10 minutes before giving a low-battery warning). I ran the laptop until it forced itself into sleep mode - now, it's been sleeping for about 5 days! Is there a way to get it to drain all the way faster?? Thank you.

    As I understand it, most iBook batteries were not subject to "battery memory" as the symptom was sometimes referred.
    I'm guessing your iBook G3 and the included battery have more than a few charge cycles and the battery may simply be at the end of its life.
    Replacement batteries are somewhat expensive but may be your only option for running your iBook off of AC Power...

Maybe you are looking for