DCIteratorBinding Looping Example - jdev 11.1.2

Hello:
Thanks for looking at this post.
In the HR schema, I drag the departments data control to a page with a backing bean. I use the following code to get a reference to the DCIteratorBinding in bean.
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
DCIteratorBinding dcIter = (DCIteratorBinding) bindings.get("DEPARTMENTS_VO1Iterator");
What is the correct way to iterate over the rows within this binding?
For example: I would like to print out the department_id for each row in the iterator with System.out.println()
Can anyone share some sample code to exercise various bindings?
Thanks for the help.

From the iterator, you can get handle to the view object by calling *.getViewObject* method on the iterator.
With the view object, you can iterate over the rows as follows:
*// create secondary row set iterator with system-assigned name*
RowSetIterator iter = vo.createRowSetIterator(null);
*while (iter.hasNext()) {*
Row r = iter.next();
if(r != null)
System.out.println(row.getAttribute("<ATTRIBUTE_NAME>");
*// close secondary row set iterator*
iter.closeRowSetIterator();
Thanks,
Navaneeth

Similar Messages

  • For Each Loop in Jdev 10.1.2.17.84

    Is there anyway of using a for each loop in Jdev 10.1.2.17.84? I get errors for the standard syntax:
    for (int item : numbers) {
    System.out.println("Count is: " + item); }
    Am i missing something?

    Okay, i'm on 10.1.3 now and the syntax:
    for (int item : numbers) {
    System.out.println("Count is: " + item); }
    still doesn't work. What am I missing now?
    On compile I'm getting:
    Error(41,23): ; expected
    for the line with for (int item : numbers) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • For loop example

    I've had a quick flick through the headers but can't find if this has been posted before, apologies if it has been covered. I have the JDK 1.6.0 and I use TextPad to compile and run Java. The simple example I have in a textbook does not work:
    for (int i=10;i=0;i--)
    System.out.printlin(i);
    If I compile as above, I get:
    C:\Fiona\java\FlatBroke.java:8: incompatible types
    found : int
    required: boolean
              for(int i=10;i=0;i--)
              ^
    1 error
    Tool completed with exit code 1
    BTW, the ^ appears underneath the "=" in the part of the for statement "i=0", it doesn't seem to paste properly here.
    If I change the line to for (int i=10;i<0;i--) it compiles OK but running the app, produces no output, ie ignore system.print etc statement.
    Help?

    for (int i=10;i=0;i--)
    System.out.printlin(i);
    If I compile as above, I get:
    C:\Fiona\java\FlatBroke.java:8: incompatible types
    found : int
    required: boolean
              for(int i=10;i=0;i--)
              ^
    1 errorYou're confusing assignment and equality tests. The middle expression in a for loop should be an expression whose value is a boolean. But in "i=0", the single equals sign means assignment. You're setting i to zero there. The value of an assignment expression is the value assigned -- in this case, an integer.
    So the compiler is complaining because the expression should be boolean-valued, but what you gave it is integer-valued.
    You probably meant to do "i==0" instead -- but that's wrong anyway, as we'll see...
    If I change the line to for (int i=10;i<0;i--) it
    compiles OK but running the app, produces no output,
    ie ignore system.print etc statement.That's because the loop ends as soon as the expression is false. "i<0" evaluates to true only if i is greater than zero -- but you've just set it to 10, which is greater than zero.
    What you probably want to do in this loop, is "i > 0".

  • JSF hr schema passing parameters example JDev V10.1.3.2.0

    Hi All,
    Is there a standard way of using the hr schema to "select an employee" to edit within an editEmp page by 1st choosing from a list of employees belonging to a department, then from this list select the employee to edit.
    I have been able to select an employee to edit by creating a named query based on
    the employee table and pass the value of a parameter (empName) to the editEmp page.
    That works well.
    I now wish to "select an employee" by 1st choosing from a list of employees belonging to a department, then from this list select the employee to edit.
    ie. named query depNamedQuery with parameter called departmentName
    then list all employees with this departmentId
    then select an employee from this department list. Call editEmp and pass the employeeId parameter.
    with thanks, Joe

    hi,
    I'm using Toplink to generate POJO, and the online demos such as the most current one on ADF, and using ADF with EJBs.
    Both those demos illustrate parameter passing using defining parameters within a namedQuery or a MasterForm-DetailTable method BUT both do not illustrate using a af:SelectOneChoice dropDown list of department names on one JSF page then navigate to an ADF table of employees within that selected department, then navigate to an employeeEdit ADF form page for the selected employee.
    The current online demo is a master-detail of department-Employee. One might have to use the next button to sequentially list all the departments to find the required employee.
    Is there a declarative way of selecting the employee for edit by first selecting the departmentName from a dropDownList component?
    Joe.

  • EJB 3.0 example in JDeveloper 3

    Hi,
    I'm a brand new Java Developer carefully looking to the new EJB 3.0 standard as well as the new version of JDev (10.1.3.0.4.3673).
    I decided to test some examples and ended up with this one: http://www.oracle.com/technology/products/jdev/101/tutorials/ejb_30/ejb_30.htm
    When I'm creating the HRAppFacade session bean in this example JDev generates 2 files but only shows one in the Applications Navigator. The remote interface is generated but not shown.
    I only get to see the interface in JDev when I make a difference in the filename between the interface and the bean.
    Is this expected behavior?
    Best Regards,
    Kris

    The application navigator tries to abstract complexities by providing a more high-level view.
    If you actually stand on the bean in the application navigator and look at the structure pane you should see both your files.
    One more thing to check is the system navigator that gives a more "file system" like view of your code.

  • Query about loops in an APEX calendar...

    Hi everyone,</br></br>
    I would like to know how to make a loop with the following settings:</br></br>
    1. I have a calendar on Application Express 3.0.1.00.08.</br>
    2. I do create some events on it, and got a start and end date.</br>
    3. On the calendar I can only see the event on the start date, but I need it to be seen from the start one until the end one...
    </br></br>
    So I went to PL/SQL and made the following tests:</br></br>
    1. created a loop example and tried to understand it:</br></br>
    DECLARE</br>
    a NUMBER := 0;</br>
    FS DATE := SYSDATE;</br>
    FF DATE := (SYSDATE+5);</br></br>
    BEGIN</br></br>
    WHILE ( FS < FF ) LOOP</br>
    a := a + 1;</br>
    FS := FS + 1;</br>
    dbms_output.put_line('paso ' || a); </br>
    END LOOP;</br></br>
    dbms_output.put_line('Dato a: ' || a);</br>
    dbms_output.put_line('Dato FS: ' || FS);</br>
    END;</br></br>
    I do get this as an answer:</br>
    paso 1</br>
    paso 2</br>
    paso 3</br>
    paso 4</br>
    paso 5</br>
    Dato a: 5</br>
    Dato FS: 17-MAY-08</br></br>
    Statement processed.</br></br>
    0.00 seconds</br></br>
    2. Once I had this I decided to modify what I had:</br></br>
    This is the block of code that needs to be repeated.</br></br>
    select '< a title= " TGB SCHEDUL " href = "f?p = &APP_ID.:3:' || :APP_SESSION || '::::P3_ID: ' || ID || ' " > ' || EVENT_NAME || '</a>
    ' EVENT_NAME,
    START_DATE</br>
    from     APP_TGB</br></br>
    So I placed it in the middel of the loop...</br></br>
    DECLARE</br>
    FS DATE := SYSDATE;</br>
    FF DATE := (SYSDATE+5);</br></br>
    BEGIN</br></br>
    WHILE ( FS < FF ) LOOP</br>
    select '< a title= " TGB SCHEDUL " href = "f?p = &APP_ID.:3:' || :APP_SESSION || '::::P3_ID: ' || ID || ' " > ' || EVENT_NAME || '</a>
    ' EVENT_NAME, START_DATE
    from     APP_TGB;</br>
    END LOOP;</br></br>
    END;</br></br>
    And got this message:</br>
    1 error has occurred</br>
    ·     Query cannot be parsed, please check the syntax of your query. (ORA-06550: line 8, column 3: PLS-00428: an INTO clause is expected in this SELECT statement) </br></br>
    Yes it was my mistake, I forgot the cursors in the selects… but here is where I do really need your help as I really don’t know how to implement them, and now with the variables that I have got.</br></br>
    I do really appreciate if anyone can help me out with it.</br></br>
    Best regards.</br></br>
    Jaison González</br></br>

    Hi Dimitri,<br><br>
    Once again, thank you very much for your time and answer,<br><br>
    1. Is it really necessary to do this for your whole table? There is no WHERE clause in your statement <br>
    Yes you are right I in the block of code that I sent you, I don’t have any WHERE clause but on the tests that I made, I have the following:<br><br>
    select START_DATE+level-1<br>
    from ( SELECT '<a title="TGB SCHEDUL" href="f?p=&APP_ID.:3:' ||
    :APP_SESSION || '::::P3_ID: ' || ID || '">' || EVENT_NAME||
    '</a>
    EVENT_NAME, START_DATE, END_DATE from APP_TGB WHERE ID = 141)<br>
    a connect by level <= (END_DATE - START_DATE)<br><br>
    But I as I have more that one event on the calendar, which are identified by different IDs, I remove it (the WHERE clause) thinking about the calendar’s convenience… <br><br>
    2. I guess you want in your outer select also the event_name?
    select start_date+level-1 as sdate, event_name, start_date, end_date
    from (select ... )<br>
    Yes, I will prove it and tell you how it works… sorry about it… <br><br>
    3. Not sure what you mean with that?<br>
    Right now, if I have as start date 5 and end date 10, it shows me on the first day (one) EVENT_NAME, on the second (four) EVENT_NAME, on the third (twelve) EVENT_NAME… and go on till it gets to the 10th…<br><br>
    Thank you very much for your help.<br><br>
    Best regards,<br><br>
    Jaison

  • Simple Variables example

    Hello,
    I have user rights to an Oracle 10g database but am not a DBA, so I do not have any editing permissions that I am aware of. I just use the database for queries.
    I want to understand how to use PL/SQL to enter variables but am struggling to find some simple examples of this?
    I am using Oradev Studio to run my SQL and have tried the following:
    declare
    v_dealname global_sf.deal.deal_legal_name %type;
    begin
    select
    deal_legal_name into v_dealname
    from
    global_sf.deal
    where
    deal_id = '87148804';
    dbms_output.put_line('Name: '||v_dealname);
    end;
    which I hashed together from here;
    http://www.dba-oracle.com/t_pl_sql_plsql_select_into_clause.htm
    Strangely the output section of OraDev is actually giving me this encouraging message "SQL6.sql: Execute succeeded [0.095 s]" but it is not giving me a printout of the variable as I was hoping. Is there an 'Immediate Window' or equivalent that I haven't found? Did the query actually work?
    I also tried to put a variable into the where clause in another arbitrary query:
    declare
    v_dealid INTEGER(8);
    begin
    v_dealid := 87148804;
    select
    creation_dt
    ,deal_legal_name
    ,actual_maturity_dt
    from
    global_sf.deal
    where
    deal_id
    =
    v_dealid;
    end;
    Here I am getting the error 'an INTO clause is expected in this SELECT statement'.
    Could anyone please advise me on some of these basic variables issues? Ideally a coulpe of simple examples I could use that don't require admin rights would be fantastic. It would be much appreciated.
    Thanks
    Jon
    Edited by: berlinhammer on 24-Aug-2010 04:48

    Running a debug session requires the DEBUG CONNECT SESSION system privilege, which isn't granted to PUBLIC by default, so you'll have to request it from your DBA if you want to use that (useful) facility. However it's not needed for just executing a PL/SQL block.
    Regarding enabling DBMS_OUTPUT in OraDev, the page you linked to looks more like some general background about the dbms_output package rather than a help page for the OraDev application itself. There must be a button or a preference setting somewhere. Doesn't it have a help menu? I've never heard of it I'm afraid. You don't need any special privileges to use DBMS_OUTPUT.
    Your first example looks fine, i.e:
    DECLARE
       v_dealname global_sf.deal.deal_legal_name %TYPE;
    BEGIN
       SELECT deal_legal_name INTO v_dealname
       FROM   global_sf.deal
       WHERE  deal_id = '87148804';
       dbms_output.put_line('Name: ' || v_dealname);
    END;The second one is missing an INTO clause (similar to the one in the first example), e.g. something like (untested):
    DECLARE
       v_dealid INTEGER(8) := 87148804;
       v_creation_dt         global_sf.deal.creation_dt%TYPE;
       v_deal_legal_name     global_sf.deal.deal_legal_name%TYPE
       v_actual_maturity_dt  global_sf.deal.actual_maturity_dt%TYPE;
    BEGIN
       SELECT creation_dt, deal_legal_name, actual_maturity_dt
       INTO   v_creation_dt, v_deal_legal_name, v_actual_maturity_dt
       FROM   global_sf.deal
       WHERE  deal_id = v_dealid;
       DBMS_OUTPUT.PUT_LINE
       ( 'creation_dt: ' || v_creation_dt ||
       ', deal_legal_name: ' || v_deal_legal_name ||
       ', actual_maturity_dt: ' || v_actual_maturity_dt );
    END;(You wouldn't normally hardcode the schema name in production code, as either you would own the tables or there would be synonyms in place.)
    However as Frank mentioned, that expects exactly one row to exist (no rows means a NO_DATA_FOUND exception, more than one will give a TOO_MANY_ROWS exception), hence the loop example.
    Edited by: William Robertson on Aug 24, 2010 6:53 PM

  • FOR loop messes up the DBMS_UTILITY.FORMAT_ERROR_BACKTRACE

    Hello!
    I've encountered the following problem which could be resolved for now
    by eliminating FOR loop, but that's not a good solution.
    The problem is that if some exception is raised inside the `for' loop
    with cursor, and the outer block contains exception handler with
    `format_error_backtrace' call, the last one shows not the exact line
    where the exception was raised, but the loop beginning. Let me show
    you.
    The next block loops over some table and tries to assign one of the
    field's value to local variable with intentionally low
    precision. Please look at line where exception is raised:
    ========================================
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    x number(1);
      3  begin
      4    for x_r in (select xlong from xtable)
      5    loop
      6      dbms_output.put_line('Processing... '|| x_r.xlong);
      7      x := x_r.xlong;
      8    end loop;
      9* end;
    SQL> /
    Processing... 611911
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 7========================================
    Next, I'll put exception handler with `format_error_message' call in
    it:
    ========================================
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    x number(1);
      3  begin
      4    for x_r in (select xlong from xtable)
      5    loop
      6      dbms_output.put_line('Processing... '|| x_r.xlong);
      7      x := x_r.xlong;
      8    end loop;
      9  exception
    10    when others then
    11      dbms_output.put_line(dbms_utility.format_error_backtrace);
    12* end;
    SQL> /
    Processing... 611911
    ORA-06512: at line 4========================================
    Now look how line number changed; instead of 7'th line it is 4'th
    now -- at the beginning of the loop.
    Now, let's expand this loop into explicit open/fetch/close sequence:
    ========================================
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    x number(1);
      3    cursor x_c is select xlong from xtable;
      4    x_r x_c%rowtype;
      5  begin
      6    open x_c;
      7    loop
      8      fetch x_c into x_r;
      9      exit when x_c%notfound;
    10      dbms_output.put_line('Processing... '|| x_r.xlong);
    11      x := x_r.xlong;
    12    end loop;
    13    close x_c;
    14  exception
    15    when others then
    16      dbms_output.put_line(dbms_utility.format_error_backtrace);
    17* end;
    SQL> /
    Processing... 611911
    ORA-06512: at line 11========================================
    Here we see that line number where exception was raised is now
    correct!
    I suppose the problem is in some hidden exception handling behind the
    `for' loop execution. Any help will be appreciated, thanks in advance!
    Message was edited by:
    uj2

    uj2,
    I think the reason is probably PL/SQL optimisation. Because you are using backtrace, it means you are on 10g. This means you have an automatic PLSQL_OPTIMIZE_LEVEL of 2. At this level, the compiler will re-write your cursor-for-loop to array fetches "under the covers", so my feeling is that the internal code re-organisation might have something to do with it.
    Can you try your cursor-for-loop example with these settings:
    ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL = 0;
    ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL = 1;
    Neither of these levels optimise cursor-for-loops.
    The reason your explicit fetch doesn't display the same behaviour is that the compiler doesn't optimise those.
    Of course I could be wrong, but this is where I'd start testing.
    Regards

  • How : Invoke asynchronous BPM process with callback within loop?

    Hi All,
    I'm currently using the 11g suite to create 2 BPM processes (Validate and Review). Process Validate is asynchronous and has a callback facility. I intend to invoke Validate from Review as a subprocess. My question would be, is it possible to invoke an asynchronous process with a call back? Can this be done in a loop?
    JDev : 111.1.1.4
    Thanks,
    PP.

    Sai,
    Which IDE are you using to build the client? (In fact it doesn't matter)
    Just put the jar files path into the classpath as John told. In order to find which jar files you need in this process, you can use eclipse java - jar class finder (which works with NWDS as well). Give it the class name(in this case commons.bla.bla...) and your jar files' folder, it will show you which jar file you need to put into the classpath.
    Just a little googling may help you with the class finder

  • Webcenter content service call in a loop.

    Can you please let me know how i will call a service in loop like 'workflow_approve'. When i call service in loop it thows exception, first document will approved but for other document it throws service exception 'document revision is not latest revision' but document is not having other document.
    Please help me i am stuck on this problem for a long time.
    Regards,
    Deepak Parmar

    Hi ,
    Can you share the RIDC code which you are trying to use for this requirement ?
    You can check for loop example from the following link  : http://jonathanhult.com/blog/2013/07/delete-content-ridc/
    Thanks,
    Srinath

  • Output strings from loop into one string

    im trying my best to explain my problem so ber in mind:)
    hey having a bit of trouble with outputing strings from loop
    example
    i typed ab into the textbox
    the output should be 12
    but since it is in a loop it would only output the last string and in this case is 2
    im trying to get both strings from the loop and output strings from loop into one string.
    here is some of my code to understand my problem
    // characters a to f
         char[] charword = {'a','b','c','d','e','f'};
         String charchange ;
      // get text from password textbox
                          stringpassword = passwordTextbox.getText();
                          try {
                          // loop to show password length
                          for ( int i = 0; i < stringpassword.length(); i++ ){
                          // loop to go through alfabet     
                          for (int it = 0; it < charword.length; it++){
                             // if char equals stringwords
                               if (stringpassword.charAt(i) == charword[it]){
                                    System.out.print("it worked");
                                    // change characters start with a
                                    if (charword[it] == 'a'){
                                         charchange = "1";
                                    // change to 2
                                    if (charword[it] == 'b'){
                                         charchange = "2";
                                        }

    Not sure how you are displaying the result but you could display each value as soon as you find it.
    if (charword[it] == 'a'){
        System.out.print("1");
    }If it is in a text field then use append. Or if you really need a String with the entire result then use concatenation.
    if (charword[it] == 'a'){
        charchange += "1";
    }

  • Where can I download the working jdbc for JDev-10.1.2?

    Hi! I've read a lot on this forum about the bug in JDev-10.1.2 - there are errors ora-00604 and ora-12705 in establishing connection with Oracle DB by using own jdbc. The solution of this problem is substituting jdbc from previous release JDev, for example, JDev-9.0.4. Does anybody know where I can get ONLY correct jdbc-drivers from JDev-9.0.4 without downloading ALL release? This driver is not very big (I think about 4-5 MB) while the whole release is about 130 MB.

    Sanja: Hello!
    I've got a sad news - the latest jdbc (from Oracle DB 10.2.0.1.0) didn' fit, the error remained. Moreover, the earlier established connection (in 'Connection navigator') was broken - it failed 'Test' with the sooner errors. I have Oracle 9iR2 DB for Linux FC3, the kernel is 2.6.9, I don't use kde and don't remember the version of gnome, it's from the distributive. Having replaced JDev's jdbc driver by Oracle's one from DB I obtained the passing test connection between JDev and Oracle DB with success. But in ADF-applications there were the well-known errors - ora-00604 and ora-12705. My applications on OS Windows which are written with C# are working with Oracle 9iR2 on Linux without any problem. So the matter is in JDev.
    Thanks for your suggestion about user.language, country and variant. I'll try it this evening and I hope (but not very much) that it'll work.
    Any way I've got a decision - to download previous release JDev and take jdbc from there. :-/

  • Can I be directed to a SIMPLE example of one value being passed FROM Labview TO an Onboard program to be used as a "Var Vector" in a sub.vi in the onboard program?

    I can find all kinds of examples of data FROM OnBoard Programs to the host but not the other way round. Specifically how do I get the variable into a memory location that the Board will read?

    Thank you for contacting National Instruments. There are a few LabVIEW examples that ship with NI-Motion that use the Load Constant to Variable VI to store data from your application to the onboard memory of the motion controller device. If you open NI Example Finder (click on Find Examples.. under the Help menu) and choose to browse by Directory Structure, then you can navigate to the Motion >> FlexMotion >> Onboard folder. The "Sequence of One-Axis Moves" and "Repeated Move in a FOR Loop" examples both store information in variables on the motion controller, whose data is later used in the onboard program. From your post, this is what it sounds like you are interested in doing.
    Also, if you are new to onboard programming and want to look over some more informa
    tion on developing those applications then I would recommend starting with Chapter 15 of the NI-Motion User Manual, where it discusses onboard programming. You can also reference the following website and the links on it:
    On-board Programming in FlexMotion
    http://zone.ni.com/devzone/conceptd.nsf/webmain/F03A6DE53C744C5886256857005ECDBE?opendocument
    If this does not answer your question or if I miss understand your request then please let us know.
    Regards,
    Michael
    Applications Engineer
    National Instruments

  • Memory leak/overload when looping by index over a large query and updating each DB record

    I am importing a CSV file into a temporary table and then running a select query that joins my actual database table with the temporary table, looking for any changes in the data. If changes exist, the select query is looped from 1 to #recordCount# and an update is applied to each record via cfquery. It runs very quickly (much more quickly than looping the query itself), but my memory spikes and overloads after about 1500 updates are completed. I need to be able to do upwards of 20000 at a time, without killing my system. I have tried manually setting the runtime garbage collection to trigger after X number of loops, but that doesn't seem to help. I am running CF8. See below for loop example:
    <cfloop from="1" to="#updatedRecordsQuery.recordCount#" index="a">
    <cftry>
                    <cfquery datasource="#db#" name="doUpdate">
                        UPDATE
                            CI
                        SET
                            firstname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#updatedRecordsQuery.firstname[a]#" />,
                            lastname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#updatedRecordsQuery.lastname[a]#" />,
                            etc, for about 15 various fields
                        FROM
                            client_info CI
                        WHERE
                            CI.client_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#updatedRecordsQuery.client_id[a]#" />
                    </cfquery>
                    <cfcatch type="database">
                        <cfset local.updateErrorList = listappend(local.updateErrorList,updatedRecordsQuery.client_id[a]) />
                        <cfset local.error = true />
                    </cfcatch>
               </cftry>
    </cfloop>

    I would suggest to use select update instead of looping over query object and update each row one-by-one.
    Procedure:
    - Insert your CSV data into temp table.
    - Use a select update SQL query to update the changed data instead of looping over a select query.
    Example:
    UPDATE
       Table
    SET
       Table.col1 = other_table.col1,
       Table.col2 = other_table.col2
    FROM
       Table
    INNER JOIN
      other_table
    ON
       Table.id = other_table.id
    NOTE: You can put all your scripts in a Procedure.

  • Go to the top of the loop

    Guys what is the command to go to the beginning of the loop.Example
    int var = 0;
    while(var <= 10){
    var = var + 1;
    if (var == 5){
    go back to while loop
    do something a
    do something b
    do something c
    do something d
    }

    break goes to the bottom of the loop (it ends the loop), continue goes to the top of the loop (interrupts the current iteration of the loop and goes to the next iteration).

Maybe you are looking for