A loop in exonentially duplication line selector

Using Apex 4.2

Background

Created a tabular presentation based on a view. Removed all updates of several default lines and destruction, buttons and processes.

I use a tabular form due to the fact that I can access a line selector.

The data in the row itself are all read only so it is a report with a line selector.

It's because I can't find a way to select a line interactive report, well I can and did, but it's a work around.

Problem

I created a button to process the selector to run the code below:

begin
kdm_adm_utils.log ('Page', 'XKDM: WF: Current Development', 'Selected Check Boxes:'||wwv_flow.g_f01(1)) ;
kdm_adm_utils.log ('Page', 'XKDM: WF: Current Development', 'Selected Check Boxes:'||wwv_flow.g_f02(1)) ;


   for i in 1..wwv_flow.g_f01.count
   loop
   kdm_adm_utils.log ('Page', 'XKDM: WF: Current Development', 'i:'||i) ;
      kdm_adm_utils.log ('Page', 'XKDM: WF: Current Development', 'WF ID:'|| wwv_flow.g_f02 (wwv_flow.g_f01.count)) ;
   end loop;
end;

I just wanted to see what would be output. For a line it works oddly and I can't find the ID based on the line

When I select multiple lines in the loop executes the wrong for the number of lines but manages also to the number of selected lines.

So if I've selected three lines this above procedure would go three times, each time to loop three times.

I put the scope of execution: created for and changed lines in the State of the button that is displayed.


Mandatory

I only want to loop through the selected lines once by click of a button

OR

Know what line I'm currently traveling.

Really would appreciate some sort of entry here.

The problem is not with the loop. It works perfectly. The problem is that it happens for the same number of rows are selected. I got around the problem with a global variable that I put and don't forget to run only loop once. Bit inefficient but still to learn the inner workings of the APEX

Tags: Database

Similar Questions

  • (Editable report) SQL query with line selector

    I used this code to get the update of the records in a query SQL (editable report).
    Updates a value in a selection box.

    because me in 1... apex_application.g_f01. Count
    loop
    UPDATE CONTRACTS
    SET LOAD_FLAG =: P8_SELECT
    WHERE ID = apex_application.g_f01 (i); -i'the checked the file 'primary key '.
    end loop;

    Here's my dilemma.
    Line selector seems to be in a fixed position.
    By linking the line for identification number selector (1, 2, 3, etc.)
    Sort by ID (1, 2, 3, etc.)
    It works perfectly, as long as the ID is sorted in order. < <
    If it is sorted by another field with say ID 29 now in the 1st row, by checking the box and update, you update ID #1 located elsewhere on the page.
    Any ideas how to make the line selector literally equal to the line, it is displayed in?
    Thank you
    Bob

    I think I have an idea of what is wrong and, eventually, how to fix it. Try this:

    make your field primary key (NO ROWID!) in a column in a table column, either through the "wizard" (i.e. through the report attributes screen), or using the APEX_ITEM api (as described by Vee). I often have my primary key as a hidden; If you really need to see it, you can use "DISPLAY_AND_SAVE".

    So if your primary key 'ID' colum is now in the 2nd table as a table (i.e. f02 - adjust accordingly!), your PL/SQL process should look like this:

    for i in 1 .. apex_application.g_f01.count
    loop
       UPDATE CONTRACTS
          SET LOAD_FLAG = :P8_SELECT
        where ID = apex_application.g_f02(apex_application.g_f01(i)); 
    
    end loop;
    

    It of a little confusing at first but it it makes sense when you train how tabular tables work with check boxes. The length of this array represents only what is verified - so if you have 3 values checked, the cardinality of the table in a particular table 3. On the other hand, your other tabular berries (containing the 'normal' values) has a cardinality of the count of all the visible lines.

    In this case, the record selector (F01) contains the ID of the relevant line in your report - so passing this value in the array index 2 (F02) should give you the correct primary key for that particular line value. If you subsequently order the report by another field, it should work again.

    I should add that Vee method will work well - the difference is that, instead of organizing the rowid, f01 contains the actual key value. Hope this helps

    Published by: Joel_C on March 21, 2011 11:50

  • Report of update SQL query with line selector. Update process.

    I have a report of update SQL query with the selectors in line.
    How to identify line selector in a process update on the page.

    I want to update some columns with a value of an area of selection on the page.

    With the help of the base:

    UPDATE table_name
    SET Column1 = value
    WHERE some_column = some_value

    I would need to do:

    UPDATE table_name
    SET column1 =: P1_select
    WHERE [line selector] =?

    Now sure how to identify [line selector] and/or validate it is checked.
    Thank you
    Bob

    Identify the name of the checkbox of the source of the page element, it should be of the fxx format (f01, f02... f50).
    Suppose that we f01.

    for i in 1 .. apex_application.g_f01.count
    loop
      UPDATE CONTRACTS
      SET SIP_LOAD_FLAG = :P16_STATUS
      where  =  apex_application.g_f01(i); --i'th checked record' primary key
    end loop;
    
  • Is it possible to programmatically control line for a line selector?

    Greetings,

    I have a report that contains the line selector column. I'm processing lines which are activated by the user when he clicks on a button, so I'm already a loop through FOR ii IN 1... Apex_Application.g_f01. COUNTY.

    I need some lines to always be dealt with in the loop, so I would:
    1 have some lines checked automatically. Is this possible?
    2. using the same logic that automatically checks some lines, I also want to make sure they remain activated, or processes in the loop. (You know, I can check automatically certain lines, but the user can disable the). So, even if the user does not check them, I would check a program before the second FOR IN 1... Apex_Application.g_f01. COUNTY loop occurs.
    3. If it is possible to prevent the disabling of a line that is automatically checked it would be great and would mean that requirement 2 is debatable. If possible let me know. That would be sweet. :-)

    I hope that makes sense, and that you understand what I have to do. If this is not the case, let me know.

    Thanks in advance for your help, Tony

    This should work:

    htmldb_item. CheckBox (2, ecn_approval_master_id, Decode (Mandatory, 'Y', 'disabled', null), Decode (Mandatory, 'Y', ecn_approval_master_id, null))

    This should give you something to think about :)

    Off home to watch Chelsea play now, come on the blues. Talk 2mrw

    See you soon

    Shunt

  • How to upgrade the value of line in a report by using the line selector (check box)

    Hello

    I have a requirement where I need to make PLSQL update process on a specific line in my report.
    Based on the line selector (marked) the plsql process update on the values of the selected line.

    I have to update status of the employee selected as 3.
    But regardless of the choice of line selector, juice processing SRM application in a sequence that is., this is row selected, application takes the first line and updates the status.

    My update process from looks like this:

    BEGIN

    BECAUSE me in 1... apex_application.g_f01. COUNTY - checkbox
    LOOP
    If apex_application.g_f01 (i) only IS NOT NULL then - box marked
    insert into values TEMP_T (apex_application.g_f03 (i), V ('APP_USER')); -f03:Deptno
    update status set Table_x = 3 where deptno in (select deptno from TEMP_T where rtrim (lower (apex_user)) = rtrim (lower (V ('APP_USER')));
    delete from TEMP_T where rtrim (lower (apex_user)) = rtrim (lower (V ('APP_USER')));
    end if;
    END LOOP;
    END;

    Once the user selects the line selector, application needs to update the status of this particular emp 3 in Table_X.
    Currently, if I select a line, using the line selection box, my update process changes the status of the first record line. If I select three rows, then my first three rows updated.
    So I have to update the particular line or selected using the selector (checkbox) row lines

    If you could help me solve this question would be really appreciated.

    Thank you
    Vijay

    This example shows how to use checkboxes in tabular form:

    http://HTMLDB.Oracle.com/pls/OTN/f?p=31517:95

    Denes Kubicek
    ------------------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    ------------------------------------------------------------------------------

  • For loops with the cursor line and indexing

    Hi all

    I have a question about the loops with the cursor, line and indexing.

    How can I scan via a cursor with an iterator?

    I would use an iterator as

    Whole LoopIndex;
    Whole LoopIndex2;

    for LoopIndex at the beginning of the cursor at the end of the cursor
    loop
    line =: cursor [LoopIndex];
    for LoopIndex2 of LoopIndex at the end of the cursor
    etc...
    end loop;

    I need to use an iterator because I need to use a nested for loop.



    OR


    How can I solve the following problem?

    Class name % ofClass average test Score
    1 Niobe 7 8 8.4
    1 alena 4 7 7.5
    1 9 7 8.9 Estia
    1 Lilly 10 8 9.8
    1 Sandra 6 8 8.3
    1 Melanie 8 8 8.1
    Nadia 2 8 3 4.4
    Sayuki 2 9 8 8.4
    Diasy 2 7 8 8.0
    Flower 2 7 8 6.5
    Diana 2 6 8 7.3
    3 Flora 7 8 5.8
    Sukiya 3 4 8 8.4
    Samantha 3 10 8 7.7
    Roxanne 3 7 8 6.9
    Eline 3 8 8 7.4

    I need to
    -By class, I need to recalculate each average people
    -By class, I need to calculate the % of class score (sum averages / people in the class)

    So it can be done in a nested for loop?
    Or do I just step by step?

    Well, based on this information it would be something like...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 1 as Class, 'Niobe' as Nm, 7 as Score, 8 as Tests, 8.4 as Average from dual union all
      2             select 1, 'Alena', 4, 7, 7.5 from dual union all
      3             select 1, 'Estia', 9, 7, 8.9 from dual union all
      4             select 1, 'Lilly', 10, 8, 9.8 from dual union all
      5             select 1, 'Sandra', 6, 8, 8.3 from dual union all
      6             select 1, 'Melanie', 8, 8, 8.1 from dual union all
      7             select 2, 'Nadia', 3, 8, 4.4 from dual union all
      8             select 2, 'Sayuki', 9, 8, 8.4 from dual union all
      9             select 2, 'Diasy', 7, 8, 8.0 from dual union all
     10             select 2, 'Blossom', 7, 8, 6.5 from dual union all
     11             select 2, 'Diana', 6, 8, 7.3 from dual union all
     12             select 3, 'Flora', 7, 8, 5.8 from dual union all
     13             select 3, 'Sukiya', 4, 8, 8.4 from dual union all
     14             select 3, 'Samantha', 10, 8, 7.7 from dual union all
     15             select 3, 'Roxanne', 7, 8, 6.9 from dual union all
     16             select 3, 'Eline', 8, 8, 7.4 from dual)
     17  --
     18  -- END OF TEST DATA
     19  --
     20  select class, nm as "NAME", score, tests, average
     21        ,round(((average*tests)+score)/(tests+1),1) as avg_person
     22        ,round((average / sum(average) over (partition by class))*100,1) as class_average
     23  from t
     24* order by class, nm
    SQL> /
    
         CLASS NAME          SCORE      TESTS    AVERAGE AVG_PERSON CLASS_AVERAGE
    ---------- -------- ---------- ---------- ---------- ---------- -------------
             1 Alena             4          7        7.5        7.1          14.7
             1 Estia             9          7        8.9        8.9          17.5
             1 Lilly            10          8        9.8        9.8          19.2
             1 Melanie           8          8        8.1        8.1          15.9
             1 Niobe             7          8        8.4        8.2          16.5
             1 Sandra            6          8        8.3          8          16.3
             2 Blossom           7          8        6.5        6.6          18.8
             2 Diana             6          8        7.3        7.2          21.1
             2 Diasy             7          8          8        7.9          23.1
             2 Nadia             3          8        4.4        4.2          12.7
             2 Sayuki            9          8        8.4        8.5          24.3
             3 Eline             8          8        7.4        7.5          20.4
             3 Flora             7          8        5.8        5.9            16
             3 Roxanne           7          8        6.9        6.9          19.1
             3 Samantha         10          8        7.7          8          21.3
             3 Sukiya            4          8        8.4        7.9          23.2
    
    16 rows selected.
    
  • Using the line selector

    I have an updated report in which I added a line selector. I can't find information anywhere where I can reference columns that have been selected. What I want to do, it's the user selects some lines, and then click a button. Then update a field on each of the selected lines.

    In my opinion, this is probably a simple act, I can't find documentation on how to do.

    Thank you.

    Ben,

    Example of the Dene here should help you get started:
    http://Apex.Oracle.com/pls/OTN/f?p=31517:95

    Kind regards
    Dan

    Blog: http://DanielMcGhan.us/
    Work: http://SkillBuilders.com/

  • Tabular form line selector to hide for some lines?

    Hello

    I was curious, if it is possible to hide the selector box in line for certain items? For example
    If a value is of a certain column in a row I want to hide the box and display it in other cases...

    Thanks in advance!

    Hello

    This setting works only for an entire column.

    There are at least three possibilities:

    1. create the box using APEX_ITEM. CHECKBOX (see: [http://download.oracle.com/docs/cd/E10513_01/doc/apirefs.310/e12855/apex_item.htm#CHDDCHAF])

    2. create a custom report template "Named column (model line)" - where you can define the layouts for each line the conditions up to 4

    3 - using javascript to analyze the data in other columns and disable or remove the boxes where required

    Option 1 is probably easier, but you need to remove the line selector of the report that it is no longer necessary

    Andy

  • Display the number of lines based on a line selector

    Hello


    We have a form on an sql query. We are currently showing 100 lines per page. We would like to have a line selector, so the number of lines displayed on the page depends on the value selected in the line selector. I'm not sure how this is possible.

    Thanks in advance,

    Hello

    It is relatively easy to set up - see: [http://apex.oracle.com/pls/otn/f?p=267:111]

    There are 4 steps to create this feature:

    1. create a "select list with Submit" on your page called, say, P111_ROWS. The source of the list value:

    STATIC2:10;10,20;20,50;50,100;100,200;200,500;500,1000;1000,All;1000000
    

    (Of course, you can change these values according to your needs)

    Display Set Null and display additional values to no.

    2 create a calculation on your page that defines the new element value static assignment of, say, 10. This calculation should depend on the element is null (this simply sets a default initial value)

    3. create a branch of page that links to the same page and check the option reset Pagination

    4. on attributes of the region of your report, enter the name of your new item in the parameter 'Number of lines (element)' - I also clear the value in the parameter 'Number of Rows.

    This should be it!

    Andy

  • Line selector, box - detailed form Master

    I'm working on form master detail. According to the business rule uses should not remove any line, but users can add lines.
    Therefore, I must hide the buttons remove and check boxes (including master CheckBox). I have set the hide buttons, but I have the challenge on the box.
    To hide the column of the box, I unchecked the box display of line selector in the report attributes. Even if the boxes were gone, I could not add a new line.

    Please help me to hide the checkboxes with possibility to add new lines.

    Thanks in advance,

    Sam

    Sam,

    If you do not plan to delete, you can set the status of the Multi line safely delete forever. I did it for you.

    Kind regards
    Dan

    http://danielmcghan.us
    http://sourceforge.NET/projects/tapigen

  • How to add a line selector

    Hello

    I'm usign a latest version of Application Express 3.1.1.00.09 how do I add a line selector in this version in older versions that I use to make the report can be updated and add a line here selector in this version, I think that we have any option please suggest me adding a line selector


    Thank you
    Sudhir.

    Hello

    In the header of your column, you can put

    
    

    Kind regards
    Dimitri
    ----------------------------------
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/
    AWARDS: Don't forget to mark correct or useful posts on the forum, not only for my answers, but for everyone!

  • Show the button when in a table line selector is checked.

    Hi all

    I have a problem with the display / hide button in the tabular presentation selector line box is checked.

    It is used when the line is posted. But when I add the line and the line is not registered it does not work.

    Could you you that someone please let me know why this does not work when the line is not registered?

    I have the ready example in apex.oracle.com

    APP ID: 62796

    User: Nancy

    Pass: Devone123

    WS: troylagi

    Thank you

    Troy.

    Hi Troy,

    Your new line in the form of tables is dynamic html, so the scope of the event must be dynamic. I changed your dynamic action that this:

  • Selection of a line selector must disable the other selectors in line

    Hello
    I have a tabular presentation. By selecting a switch line should disable the other selectors (boxes) of the line. Means I should be able to select one line at a time and present. How do I do that? THX in advance

    I have a tabular presentation. By selecting a switch line should disable the other selectors (boxes) of the line. Means I should be able to select one line at a time and present. How do I do that? THX in advance

    Version of the apex?
    If 4.x can see {: identifier of the thread = 2428661}, adapt to your particular case.

    See you soon,.

  • SLQ: A loop with the select line, counters and variables

    Hello!

    I have a bit of a pickle SQL and would be very happy to any experienced help.
    I have a big enough table that contains two columns in particular (illustrated by a few examples)

    REFERENCE
    Mouth Med Chem (2008) 16, 1111-1124
    Bioorg Med Chem Lett. 2008 may 1; 9:2820 - 4 EPUB 2008 Apr 4
    BR J Pharmacol. In February 1999; 3:665 - 72.

    2_ YEAR
    1996
    2001

    Sometimes, the two columns are null. What I want to do, it is to loop through the table and pull on the date of the REFERENCE column and update the YEAR_2 column with it.

    My current code snippet is as follows:

    declare
    x number: = 1995;
    cursor s1 is SELECT rowid, t.* FROM CB1ASSAYS t WHERE REFERENCE like "%x % ';
    Start
    While x loop < 2006
    C1 loop s1
    Update CB1ASSAYS set YEAR_2 = x
    where REFERENCE like "%x % ';
    x: = x + 1;
    end loop;
    end loop;
    commit;
    end;
    /


    However, it doesn't seem to work properly. He updated lines with 1995 in the year, but no date higher. Curiously, he updated a number of records with the year 2064, when there was no 2064 anywhere in the REFERENCE entry.

    There are no errors encountered when I run this script.

    Any idea?

    Thank you!

    In your code the where conditions update should be:

    WHERE REFERENCE like '%'||x||'%';
    

    and you can get rid of the slider at all:

    declare
     x number := 1995;
    begin
     while x < 2006 loop
       update CB1ASSAYS set YEAR_2 = x
       where REFERENCE like '%x%'
       AND YEAR_2 is null --To update only null years
       ;
       x := x + 1;
     end loop;
    --commit;  IT's better you you commit after checked if all is ok...
    end;
    /
    

    Max

    Published by: Massimo Ruocchio July 5, 2011 19:59
    got rid of the cursor loop for...

  • How to manage the default checkbox (line selector)?

    Hello

    I have a form where there is a default checkbox and I created a button named CANCELLED to cancel the special line, every time the user wants to cancel a particular line, it checks the check box so that, in the back-end, we took a cancel_flag of the column where it is appropriate to update this column 'Y' for the line selected by the end user.

    How can manage us this scenerio for the above context? Please any help will be greatly appreciated.

    TIA,
    By,.
    Murielle.

    Hello

    Create after submit conditional process your button

    BEGIN
    FOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOP
    UPDATE your_table
    SET cancel_flag = 'Y'
    WHERE your_chk_column = APEX_APPLICATION.G_F01(i);
    END LOOP;
    COMMIT;
    END;
    

    Change 'your_table' and 'your_chk_column' according to your table
    BR, Jari

Maybe you are looking for