Loop with apex_application

I am making a loop with the apex_application, but my loop is inline and not collumn.
Has how concatenates APEX_APPLICATION.G_f0||I ?
Example of code:
FOR I IN 8 .. 32 LOOP
IF I < 10 THEN
V_SOM_QTD := V_SOM_QTD + TO_NUMBER(NVL(APEX_APPLICATION.G_f0||I,0));
ELSE
V_SOM_QTD := V_SOM_QTD + TO_NUMBER(NVL(APEX_APPLICATION.G_f||I,0));
END IF;
END LOOP;

Hello Paulo,
>> I am making a loop with the apex_application, but my loop is inline and not collumn.
You didn’t specify the APEX version you are using. If it’s 4.1 and above, you no longer need to loop through the various G_Fxx arrays, but you can reference the column value on each row by using a bind variable notation with the name of the column.
As Paul mentioned, It’s a bit more code to write, but for the long run it’s easier to maintain and it's more readable.
Regards,
Arie.
&diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
&diams; Author of Oracle Application Express 3.2 – The Essentials and More

Similar Messages

  • Update process with APEX_APPLICATION

    Hi Friends,
    I have a APEX page made with APEX_ITEM. I created the below process [which will run on a Button Click].
    my issue is : Process completes with out updating the Database showing the Process Success Message. I do not see any errors. I checked the documentation and other examples for usage of APEX_APPLICATION and could not find any mistake.
    All fXX columns are rightly displayed on the page and are mapped correctly in Insert and Update stmts of the below process.
    Any suggestions to debug will help..
    <Code here>
    DECLARE
    v_cp_id NUMBER;
    v_cp_line NUMBER;
    BEGIN
    v_cp_id:=nv('P32_CP_ID');
    for i in 1..apex_application.g_f02.count
    loop
    if ( apex_application.g_f02(i) is not null) then
    update CP_OTHER_TRANSACTION_DETAILS
    set BUSINESS_TRANSACTION_NAME = apex_application.g_f03(i),
    DESCRIPTION = apex_application.g_f04(i),
    TRANSACTIONS_PER_PEAK_HOUR = apex_application.g_f05(i),
    SLA = apex_application.g_f06(i),
    CSD_LINK = apex_application.g_f07(i)
    where CAP_PLAN_ID = apex_application.g_f01(i) and LINE_NO = apex_application.g_f02(i);
    ELSE
    IF ( apex_application.g_f03(i) is NOT null) then
         SELECT NVL(MAX(LINE_NO),0)+1 INTO v_cp_line FROM CP_OTHER_TRANSACTION_DETAILS;
    insert into CP_OTHER_TRANSACTION_DETAILS
    (CAP_PLAN_ID,
         LINE_NO,
    BUSINESS_TRANSACTION_NAME,
    DESCRIPTION,
    TRANSACTIONS_PER_PEAK_HOUR,
    SLA,
    CSD_LINK
    values
    (v_cp_id, v_cp_line,
    apex_application.g_f03(i),
    apex_application.g_f04(i),
    apex_application.g_f05(i),
    apex_application.g_f06(i),
    apex_application.g_f07(i) );
    end if;
    end if;
    end loop;
    COMMIT;
    END;
    </Code here>
    Thanks ..

    Having looked at your app, I would suggest you recreate this page using a Tabular Form based on a Table/View. This feature will automatically take care of adding new rows, updates etc., as well as those all important record lock mechanisms!
    As for what you have at the moment, the problem lies in the hidden elements on the form - the PL/SQL process was never dropping into the loop because apex_application.g_f02.count is zero! This is because the columns are flagged as "not shown".
    To include these items, modify the SQL in your report to concatenate the items together with the first displayable item on the page.
    Therefore something like this:
    select apex_item.hidden(1,CAP_PLAN_ID) ||
             apex_item.hidden(2,LINE_NO) ||
             apex_item.text(3,BUSINESS_TRANSACTION_NAME) BUSINESS_TRANSACTION_NAME,
    apex_item.text(4,DESCRIPTION) DESCRIPTION
    .NOTE - the first two fields are concatenated to the business_transaction_name column, but remain hidden when the page is displayed!
    Hope that makes sense!
    Edited by: FFS on 09-Mar-2010 08:51
    Edited by: FFS on 09-Mar-2010 09:07
    Edited by: FFS on 09-Mar-2010 09:12

  • Why writes LabVIEW only every 2 seconds the measured Value to a Excel (In a while loop with 100 ms tact)?

    Hi everybody,
    I use the myDAQ to measure speed, ampere, and voltage of a battery driven motor. (For Current measurement, i use a Sensor which outputs a 0-10 V signal). I placed all DAQ-Assitants in a while loop with a [Wait until next ms multiple] clock and set a value of 100 ms. I thougt, Labview will now write into my text file 10 times a second all values. In fact, as you can see in the attached text file, Labview only writes in a unsteady interval of 1-2 seconds a value, which is too less.
    The question: Did I do anything wrong, how can you create VI that writes you lets say 10 values a second into text file? Or is simply the DigitalMultimeter input of the myDAQ not able to sample a rate of 10 Hz? I couldn´t find any information in the specification handbook about the sample rate of the DMM?
    If anyone can help me would be great! Thanx a lot, Markus
    Attachments:
    Measure Speed+Current+Voltage into Excel.vi ‏175 KB
    Test7.txt ‏1 KB

    File I/O is not very efficient. I recommend that you do you file logging in a parallel task. Have one task do your data acquision. This task would then pass the data to be logged to the logging task via a queue. That way your file operations do not impact your data acquision. Also, express VIs are not very efficient. You would be better off accessing that directly using the DAQ VIs. The express VIs contain lots of steps that do not need to be done every time you call it such as initializing the device.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Working in Logic 9, how do I use a drum loop WITH ITS PRESET EFFECTS? I can drag and drop the loop but it plays dry in timeline. thanks

    Working in Logic 9, how do I use a drum loop WITH ITS PRESET EFFECTS? I can drag and drop the loop but it plays dry in timeline. thanks

    Here's the short-cut solution:
    Green Apple tracks are MIDI files (so to speak). If you drag one from the loop browser (Capitol C Orchestral hit, as you mentioned in this exable) directly into the arrange page it creates the MIDI file and the instrument to play it back on.
    HOWEVER.If you create and audio track first, THEN drag the green Apple loop onto that track, the loop will get "bounced" with the reverb in tact and you'll have the exact sound that you heard in the preview.
    Make sense?

  • Data acquisition loop with queue

    What I would like to do is have a data acquisition loop that samples a load cell at 500Hz and have another loop that runs much slower to run a state machine and display some data in real time.  The reason I want to sample the load cell so fast is to filter out some noise.  Making producer/consumer loops with a queue kind of makes sense but I don't really care about all of the samples, I just want to be able to read a real time filtered signal at certain times.  I looked at having just two parallel loops, one to acquire the data and the other to run a test and retrieve a real-time signal when I want but not sure how to pass data between the loops without using a queue.  You can do it with local variables but you are at risk of a race condition.  I hope this make sense.  I am sure this is a simple problem I just don't know what direction to go.  Thanks

    Good Evening secr1973,
    It sounds like you are on the right track.  You already know about the producer/consumer architecture; this is almost always the first step to the separation that I think you are after.
    The step that I think you are missing is a Case Structure around the enqueue element VI.  You likely have some event or specific pattern that you are looking for in the input signal.  You can have the output from this algorithm (likely a boolean) determine which case of the Case Structure to execute (Case 1: enqueue the element or Case 2: Do not enqueue the element).
    This, of course, leads to processing being done in the producer loop, which is quite the opposite of what you are trying to accomplish with the producer/consumer architecture.  You will have to decide if your processing is very simple or more complicated.
    If it is easy/fast, you can likely get away with doing this processing in the producer loop.  My guess is that your program falls under the category of do-it-all-in-the-producer loop because you are only acquiring at 500 Hz.
    If the application requires faster acquisition rates or if the logic is going to require some processing, you may want to implement a double layer producer/consumer architecture.  In this setup, you would pass all of the data from the DAQ producer to a second loop (using queue #1) that determines what to do with the data (to enqueue or not to enqueue...) and, if appropriate, write to a queue (queue #2) that the third loop can read.  The third loop would be where your state machine executes.
    If you have a quad core machine, each of these steps will execute on its own core.  If not, you will have a little more thread swapping; not a huge concern in most cases.  Here, we get into the art of programming more than the science.
    In any event, I think you will be OK with a little processing for the enqueue or not algorithm in the producer loop.
    Regards,
    Charlie Piazza
    Staff Product Support Engineer, RF
    National Instruments

  • How to create a textfile dynamically(with in the loop) with given data?

    Hi all,
    Can anyone Please guide me how to create a text file in the given path dynamically? (with in the loop) with given data.
    For example:
    <%
    String data1="name";
    String data2="address";
    for(int i=0;i<10;i++)
    create the textfile at c:/test/sample.txt//name of the each file created being "sample.txt"
    //contents of text file will be
    data1+i; //to get name1,name2.....
    data2+i// to get add1,add2........
    delete(sample.txt) //to enable to create another file in the loop with same name
    %>

    The code which Ashokan mentioned is not is not creating a file.
    i used code given below to create and write into it.
    But, not is writing into it. I don't konw, where i am going worng !
    Code
    String sample2="C:/Ash/sample2.txt";     
                                                                                    FileWriter fw = new FileWriter(sample2,true);
                                            BufferedWriter bw=new BufferedWriter(fw);
                                            bw.write("EMP ID");     
                                            bw.newLine();
    Please help
    Regards
    aSh

  • Hi guru's in ABAP loop with in the loop is possible

    hi guru's in ABAP loop with in the loop is possible

    Hi sri,
        it is posible clearly.
    see this code.
    data: t_spfli type table of spfli with header line,
           t_sflight type table of sflight with header line.
    select * from spfli into table t_spfli.
    select * from sflight into table t_sflight.
    loop at t_spfli.
      write:/ t_spfli-carrid,
               t_spfli-connid.
      loop at t_sfplight where carrid eq t_spfli-carrid
                                 and connid eq t_spfli-connid.
        write / t_sflight-fldate.
      endloop.
    endloop.
    Plz Reward if useful,
    Mahi.
    Message was edited by:
            Maheswari Chegu

  • Adobe Extension Manager loops with the following message: "The Extension Manager will now launch and

    Hi, whenever I open Dreamweaver CS5 I get this message:
    Adobe Extension Manager loops with the following message:
    “The Extension Manager will now launch and finish updating Dreamweaver”.
    Then the manager starts and I have to wait and click a few buttons until I can close it.
    How can I stop the Extension Manager popping up?
    Thanks for advice.

    Seems to be a lot of this going on. Wondering if we're wasting our time with this??!!

  • My phone keeps on looping with the apple logo after the blue screen.

    I tried to up date my iPhone 5s thru iTunes and got error statin iTunes has detected an iPhone in recovery mode. you must restore  this iPhone before it can be used with iTunes. Saw a video on you tube to use rec boot. So I downloaded rec boot v1.3 to try and kick it out of recovery mode and my phone keeps on looping with the white screen and black apple logo after the blue screen. I tried kicking it out with tiny umbrella and nothing happens. I was able to put the phone back in recovery mode and try using tiny umbrella while still connect to iTunes and hit exit recovery mode. under log tab it says sending exit recovery request to model # of the phone and nothing happen. My last option is to restore to factory settings which I don't want to do cause I would loose every thing. Can some one tell me I'm doing wrong or how to fix it. I would be greatly appreciate it the help. Thanks in advance. 

    Its looping because the iOS is not bootable which is why the iPhone booted to the ROM recovery mode.  Try using iTunes 12's 'Update' option when the iPhone is in recovery mode.

  • Display a message in a For Loop  with field value

    Hello All,
    pls,i wanna display a message in a For Loop with field value the code is:
    FOR Q1 IN GET_SUM_EXP_QUANTITY LOOP               .
    INSERT INTO PLN_PLAN_DISTRIBUTION_WAY
    (FIN_YEAR_CODE , MONTH_CODE , MATERIAL_CODE , DISTRIBUTION_WAY , EXPECTED_QUANTITY , GROUP_CODE)
    VALUES (:PLN_PLAN.FIN_YEAR_CODE , TO_CHAR(V_FROM_DATE,'MM') , Q1.MATERIAL_CODE , 1 , V_MONTHLY_QTY , Q1.GROUP_CODE);
    MESSAGE(':PLN_PLAN.FIN_YEAR_CODE'||:PLN_PLAN.FIN_YEAR_CODE ||' '||'V_FROM_DATE = '||TO_CHAR(V_FROM_DATE,'MM'), 'Q1.MATERIAL_CODE'||' '|| Q1.MATERIAL_CODE||' '||'DISTRIBUTION_WAY'||' = 1'||'EXPECTED_QUANTITY'||' = '|| V_MONTHLY_QTY||'GROUP_CODE'|| ' '|| Q1.GROUP_CODE);
    FORMS_DDL('COMMIT');
    How 2 display a message with the value:
    Q1.MATERIAL_CODE
    Q1.GROUP_CODE
    message(Q1.MATERIAL_CODE)     
    gave me numeric or value error on run time when pressed on button
    Regards,
    Abdetu..

    Thanks 4 reply..
    again they r in a For Loop as mentioned above...
         INSERT INTO PLN_PLAN_DISTRIBUTION_WAY
                                                           (FIN_YEAR_CODE , MONTH_CODE , MATERIAL_CODE , DISTRIBUTION_WAY , EXPECTED_QUANTITY , GROUP_CODE)
                                            VALUES (:PLN_PLAN.FIN_YEAR_CODE , V_REPAIR_MONTH , Q1.MATERIAL_CODE , 1 , V_REPAIR_Qty , Q1.GROUP_CODE);
    FORMS_DDL('COMMIT');
    The fields in bold r required to be displayed for testing puposes..
    this gives me numeric or value error in runtime..
    Best regards,
    Abdetu..

  • I'm in iphoto loop with Facebook that says there's a problem with IPhoto uploader. Try again later"  It's an eternal loop and no matter what it puts me back to Setup to publish IPHOTO every time and then will not publish.

    I'm in an Iphoto loop with iPhoto uploader error and Facebook.  I cannot post to Facebook as it sends me back to setup again and then says there is an error with iPhoto uploader.  "Try again later"  This has been going on since I joined Facebook.  Cannot figure out what to do

    have you tried posting this question in the iPhoto forum? https://discussions.apple.com/community/ilife/iphoto

  • Horizontal Looper with Spry

    In ASP there are ways and extensions for creating Horizontal
    Loops in dreamweaver.
    Is there a way to create a Horizontal Loop with a Spry
    Dataset?

    It would just be a table with an image in it.
    <table>
    <tr>
    <td><img src="spryimgdata"/></td>
    </tr>
    </table>
    The img src is pulled from a spry dataset, but instead
    repeating the images all the way accross I would want to display
    only 3 images then start a new row and do another 3 images, and so
    on.
    Thanks

  • How do you start a loop with an event and end the loop when u release ....

    How do you start a loop with lets say an event of some sort, whether it be holding down a key or pressing the mouse click and then stopping the loop when you release that key or mouse button.?
    double c = 1.8, i = 1, max = 90, exp = 0;
    final double inc = 0.002; //speed at while it increases
    boolean f = false, g = false;
    while (true)
        while (f == false && stopMeter == false) //increasing speed going up to 90
            exp = Math.pow (c, i);
            i += inc;
            pAngle.setText (Math.round (exp) + "");
            if (exp > max)
                f = true;
                g = false;
            } //end if
        } //end while
        while (g == false && stopMeter == false)  //decreasing speed going down from 90
            exp = Math.pow (c, i);
            i -= inc;
            pAngle.setText (Math.round (exp) + "");
            if (exp < 1)
                g = true;
                f = false;
            } //end if
        } //end while
    } //end whilethis is a snippet of my increasing increments. Its for an angle meter. I can't get it to stop, when the user clicks or does something... the program just gets stuck in an infinite loop. I am still new to java and i do not know how to fix this.

    You are in the wrong forum. Try this one instead: http://forum.java.sun.com/forum.jspa?forumID=31
    /M

  • Threads in while loop with two data acq loops

    Good day, I am using two while loops to perform data acquisition from two different pieces of hardware inside a "main" while loop - a total of three while loops. I want each of the data acq loops to run as fast as possible. With this model will each data acq loop run in a separate thread or will they be running in the same thread because they are both inside the "main" while loop.
    I'm not getting the performance I would like and I'm looking at ways to optimize the execution. 
    Thanks
    John 

    I would have a loop for each of you data acquisition tasks and at least one, possibly two additional loops that will write your data to file. Let the acquisition loops collect the data as quickly as possible and simply queue it off for further processing. When these loops are in parallel LabVIEW will run them on separate threads. In addition you could have a separate loop with an event structure that could handle you UI interaction. This loop could control the overall application with respect to starting and stopping the tasks, etc. You don't really need to contain all these loops in any other loop or structure. They can all reside on the block diagram next to each other. Ideally you will create subVIs for the data acquision and data processing tasks.
    Message Edited by Mark Yedinak on 10-06-2009 04:29 PM
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Processing in Time Loop with microseconds.

    Hello,
    I am make one application in Labview where I capture the frame of one camera and I processing the image. The camera is communicate with the board NI PCIe 1433 in the PC with camera link. This camera can work with one frame rate of 2000 fps. For processing every frame in the pc I need one time loop that work with microseconds. The problem is that this time loop only work with millisecond in Windows. If I use the module Real Time, Can I configure this time loop with microsecond or are there other solution?
    Thanks

    Thanks,
    The purpose of this is controller the application. In this timeloop I obtain the frame and I the processer. If I configure the timeloop with 1 ms I lose frames and if I configure the application with one normal loop I can obteain several time the same frame. The frame rate can change and with this change I configure the timeloop for controller all the time the captures, not lose any and not obtain replay.
     

Maybe you are looking for