APEX_APPLICATION.G_F01(i)

Hi
I have an application that is sending emails to various users, who have specific information sent to them in the emails. what is happening at the moment is that when i check the checkbox for the 3rd person [APEX_APPLICATION.G_F01(i)]
they get the information that is stored for the 1st person .
the checkboxes are APEX_APPLICATION.G_F01(i), and the required information is in APEX_APPLICATION.G_F04(i). what i think is happening is that apex when it sees that i havent checked the first two checboxes, associates the remaining checkbox with row 1 APEX_APPLICATION.G_F04(i) as opposed to row 3 APEX_APPLICATION.G_F04(i)
is their a way round this problem.
declare
l_to varchar2(1000);
l_from varchar2(100):= '[email protected]';
l_row varchar2(1000);
l_message clob;
begin
FOR i in 1..APEX_APPLICATION.G_F01.count
LOOP
if (APEX_APPLICATION.G_F01(i)) is not null then
l_to := replace(upper(APEX_APPLICATION.G_F01(i)),'acm.COM','acm.NET');
l_message := (APEX_APPLICATION.G_F04(i),APEX_APPLICATION.G_F01(i));
APEX_MAIL.SEND(P_TO => l_to,
P_FROM => l_from,
P_REPLYTO => null,
P_BODY => l_message,
P_SUBJ => 'This Email Is From The S.H.E. Department');
end if;
end loop;
begin
htmldb_mail.push_queue(p_smtp_hostname => 'xxx.xx.xx.xxx,p_smtp_portno => 25);
end;
end;
Marco

Marco,
The code you posted will not work. Try this instead:
DECLARE
   l_to        VARCHAR2 (1000);
   l_from      VARCHAR2 (100)  := '[email protected]';
   l_row       VARCHAR2 (1000);
   l_message   CLOB;
   v_seq_no    NUMBER;
BEGIN
   FOR i IN 1 .. apex_application.g_f01.COUNT
   LOOP
      v_seq_no := apex_application.g_f01 (i);
      FOR c IN (SELECT    i.report_type
                       || ' '
                       || i.report_id
                       || ' '
                       || i.report_no
                       || ' '
                       || a.report_no
                       || ' '
                       || a.due_date
                       || ' '
                       || a.progress
                       || ' '
                       || a.last_update AS m1,
                       u.useremail AS m2, UPPER (SUBSTR (u.userid, 10))
                                                                       AS m3
                  FROM actions_tmp a, users_tmp u, incident_tmp i
                 WHERE a.actionee = u.userid(+)
                   AND i.report_id = a.report_id
                   AND NVL (a.progress, 0) < 100
                   AND (   a.last_email <>
                                    TO_DATE (SYSDATE, 'dd/mm/yyyy hh24:mi:ss')
                        OR a.last_email IS NULL
                   AND a.recommendation_comp IS NULL
                   AND i.report_id = v_seq_no)
      LOOP
         l_message := l_message || CHR (10) || CHR (10) || c.m1;
         l_to := l_to || ', ' || c.m3;
      END LOOP;
      l_to := LTRIM (l_to, ', ');
      apex_mail.send (p_to           => l_to,
                      p_from         => l_from,
                      p_replyto      => NULL,
                      p_body         => l_message,
                      p_subj         => 'This Email Is From The S.H.E. Department'
      htmldb_mail.push_queue (p_smtp_hostname      => 'xxx.xxx.xxx.xxx',
                              p_smtp_portno        => 25
   END LOOP;
END;Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://htmldb.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------

Similar Messages

  • APEX_APPLICATION.G_F01.. G_F50.. assigning sequence dynamically

    Hi,
    Can we generate F01 .. F50 numbers as mentioned below.
      declare
         v_seq number := 10;
         v1 varchar2(100);
      begin
         for i in 1..apex_application.g_f01.count
         LOOP
          v_seq :=  v_seq + 1;  -- v_seq will have value 11,12,13,..
          v1 := apex_application.g_f||v_seq||(i); -- CAN I DO LIKE THIS, I tried but getting error.
        END LOOP;
    so v_seq will have value with 11, 12, 13 each time and then I want to assign the following to v1
    apex_application.g_f11(i)
    apex_application.g_f12(i)
    apex_application.g_f13(i)
    apex_application.g_f14(i)
    So can I refer apex variables like above [G_F11, G_F12, GF13, ....]
    Thanks,
    Deepak

    DeepakJ wrote:
    Can we generate F01 .. F50 numbers as mentioned below.
    declare
    v_seq number := 10;
    v1 varchar2(100);
    begin
    for i in 1..apex_application.g_f01.count
    LOOP
    v_seq :=  v_seq + 1;  -- v_seq will have value 11,12,13,..
    v1 := apex_application.g_f||v_seq||(i); -- CAN I DO LIKE THIS, I tried but getting error.
    END LOOP;so v_seq will have value with 11, 12, 13 each time and then I want to assign the following to v1
    apex_application.g_f11(i)
    apex_application.g_f12(i)
    apex_application.g_f13(i)
    apex_application.g_f14(i)
    So can I refer apex variables like above [G_F11, G_F12, GF13, ....]No. This can only be done using dynamic PL/SQL: see +{message:id=9267909}+ for a previous example.

  • Apex_application.g_f01 picking up value of hidden column

    i have a report with a apex_item.checkbox using the id 1 and a hidden column. for some reason my pl/sql code that loops through apex_application.g_f01 picks up the value of the hidden column as well. why is this? is this a known bug?
    i managed to get my code working by using id 2.

    report code
    select ename,
    apex_item.checkbox(1,ename,null) sel,
    'RED' COLOUR
    from emp
    order by ename
    process
    FOR I in 1..APEX_APPLICATION.G_F01.COUNT LOOP
    //i insert into a test table to view results
    END LOOP;
    the above works fine until i change the COLOUR column from a standard column to a hidden column. Then for some reason the apex_application.g_f01 then includes the values of all ticked boxes plus all the values in the COLOUR column.

  • APEX_APPLICATION.g_f01  not grabbing values

    Hi,
    Have the following problem with APEX_APPLICATION.g_f01
    I created a region with the following code:
    SELECT
    apex_item.text(1, CART_DETAIL#) as CART_DETAIL#ForCart,
    apex_item.text(2, SEQ, 1) as "#"
    FROM
    The item is displayed on the screen and changed by the user.
    when I save with:
    for i in 1..apex_application.g_f01.count
    loop
    cart_det.SEQ := apex_application.g_f02(i);
    commit;
    end loop;
    end;
    The value saved is what was loaded from DB and dos,'t include changes from the user.
    Any help would be appreciated
    Thanks,
    Arik

    Hi arik103, i´m having the same problem. I recommend you to first of all check if the apex_application.g_f01.count is really counting.. do this to check it.
    create a process "on load - After regions"
    whit this source.
    BEGIN
    htp.p(APEX_APPLICATION.g_f01.count);
    END;
    I don´t know why i´m having a similar problem. When i try to take the control of a report wich i create manually.. i can´t manipulate the report with the APEX_APPLICATION

  • Access APEX_APPLICATION.G_F01 in an SQL query for a report

    APEX 4.0.2.00.07
    I've got a standard report with checkboxes. The SQL is along the lines of:
    SELECT APEX_ITEM.CHECKBOX(1,empno,'CHECKED') " ",
           ename,
           job
    FROM   empThen I have another report below this, which I want to drive based on the items checked in the first report. I know that the checkbox values will go into the APEX_APPLICATION.G_F01 collection. Normally these are accessed using pl/sql such as:
    FOR I in 1..APEX_APPLICATION.G_F01.COUNT LOOP
        DELETE FROM emp WHERE empno = to_number(APEX_APPLICATION.G_F01(i));
    END LOOP;But is there any way I can access the collection from the sql for my second report.
    i.e. I want my sql to be something like:
    SELECT empno, day_of_service
    FROM   emp_timesheet
    WHERE emp_no in <get access to the collection here>I was hoping that the check box collection would be available from the APEX_COLLECTIONS view, but it doesn't seem to be there.
    Thanks,
    John

    John,
    If the goal is to hold onto the checked values for some other processing then you could add them to a collection yourself.
    create a process on your page which looks something like this:
    This will create your collection if it does not exist or delete everything currently in it if it does exist and then insert your new selections.
    DECLARE
       l_col_name varchar2(30) := 'EMP_SELECTED';
    BEGIN
        apex_collection.create_or_truncate_collection(l_col_name);
        FOR I in 1..APEX_APPLICATION.G_F01.COUNT LOOP
            apex_collection.add_member(
                l_col_name,
                to_number(APEX_APPLICATION.G_F01(i))
        END LOOP;
    END;your second query could look something like this:
    SELECT empno, day_of_service
      FROM emp_timesheet
    WHERE empno in (select C001 empno
                       from apex_collections ac
                      where ac.collection_name = 'EMP_SELECTED')
    Edit
    some people choose to create a view ontop of certain collection queries which will be reapeated throughout the application so you could also just
    create view selected_emps as
    select C001 empno
      from apex_collections ac
    where ac.collection_name = 'EMP_SELECTED'   and your new query would look like:
    SELECT empno, day_of_service
      FROM emp_timesheet
    WHERE empno in (select empno
                       from selected_emps)Cheers,
    Tyson Jouglet
    Edited by: Tyson Jouglet on Apr 6, 2011 10:37 AM

  • How to use apex_application.g_f01 with check boxes to find unchecked items

    I have a sql report that looks like this:
    select
    case when q.request_id is null then
    apex_item.checkbox(1,q.QUALITY_ISSUE_ID)
    else
    apex_item.checkbox(1,q.QUALITY_ISSUE_ID,'CHECKED')
    end input,
    MEANING d,
    LOOKUP_CODE r
    from LOOKUP_VALUES f
    ,REQUEST_QUALITY q
    where f.LOOKUP_TYPE = 'QUALITY_ISSUES'
    and f.LANGUAGE = 'US'
    and f.view_application_id = 3
    AND f.lookup_code = q.quality_code(+)
    AND q.request_id(+) = 3464
    Now I need a process where I can insert rows when new ones are selected and delete ones that have been unchecked. For the insert, I need to know the lookup_code and for the delete, it will not be in the array. Because only checked items are passed in the array. How do I get around both issues? The table I am trying to control looks like this:
    QUALITY_ISSUE_ID     NUMBER
    REQUEST_ID     NUMBER
    QUALITY_CODE     VARCHAR2(30)
    Quality issue id is based on a seq for new inserts. Request_id is the id of the parent record, and quality code is the code coming from lookup_values
    How do I go about this?
    I'm on version 4.02
    Thanks
    Edited by: tcheney on Jun 9, 2011 1:56 PM

    hi,
    thanks for the quick response.
    i'm getting another error upon changing my sql to use
    DECLARE
    sql_v VARCHAR2(32767) :=
    SELECT apex_item.checkbox(1,''#ROW_NUM#'') item,
           e.employee_id,
           e.last_name,
           e.first_name,
           e.middle_name,
           e.email_address,
           e.tel_no,
           e.mobile_no
      FROM employees e
    BEGIN
    IF :P3_EMPLOYMENT_STATUS IS NOT NULL THEN
    sql_v := sql_v || ' INTERSECT
    SELECT apex_item.checkbox(1,''#ROW_NUM#'') item,
           e.employee_id,
           e.last_name,
           e.first_name,
           e.middle_name,
           e.email_address,
           e.tel_no,
           e.mobile_no
      FROM employees e
    WHERE e.employment_status = :P3_EMPLOYMENT_STATUS
    END IF;
    END;i'm sorry if i forgot to mention earlier that i'm using an SQL Report that has a type of SQL Query(PL/SQL function body returning SQL Query).
    anyways, i am now getting the error
    ORA-06502: PL/SQL: numeric or value error: character to number conversion errorstill have no idea what's causing this nor the error ealier.
    thanks.
    allen

  • Apex_application.g_fXX and collection problem

    Hello all!
    In the midst of writing my second apex application, it appears I need to use apex_application functionality to meet my requirements and am seeking assistance.
    I have a table/report with a column link (item_id) and a second column (as a text field) (there are more columns displayed), but I think they are irrelevant to this situation) populated with a value QTY (c002) from a collection where c001 = item_id. What I'm attempting to do is allow someone to enter a qty in the c002 text field, apply the qty change to the collection and reload the page displaying the new quantity value in the report when the column link (image) is selected (page redirects to itself).
    Since it appears that column links are not a SUBMIT, I've put my collection update plsql in a before header process. According to the debug output, this collection insert is executed long before the rendering of the report.
    This is my report plsql;
    declare
    l_query varchar2(4000) := '';
    begin
    l_query := 'select i.INVENTORY_ID, col.c002, ql.QUANTITY_AVAILABLE, i.STRAIN_CODE, i.STRAIN_NAME, i.GENOTYPE, i.AGE, i.SEX, ql.ROOM_NUMBER from SM_INVENTORY i, SM_QUANTITY_LOCATION ql, apex_collections col where ql.STRAIN_ID = i.STRAIN_ID(+) and col.collection_name (+)= ''ORDER'' and col.c001 (+)= i.INVENTORY_ID';
    end;
    This is my update collection plsql (I don't have the insert part yet, but my collection already contains values);
    declare col_item_count number;
    col_seq number;
    item_id number;
    qty number;
    begin
    if apex_collection.collection_exists('ORDER') = FALSE then
    apex_collection.create_collection( p_collection_name => 'ORDER');
    commit;
    end if;
    for i in 1..apex_application.g_f01.count
    loop
    item_id := apex_application.g_f01(i);
    qty := apex_application.g_f02(i);
    select count(c001),seq_id into col_item_count, col_seq
    from apex_collections
    where c001 = item_id
    and collection_name = 'ORDER';
    group by c001, seq_id;
    if col_item_count > 0 then
    apex_collection.update_member(
    p_collection_name => 'ORDER',
    p_seq             => col_seq,
    p_c001 => item_id,
    p_c002 => qty);
    commit;
    end if;
    end loop;
    end;
    Given all this, my collection entry is not updated with the new value of c002 displayed in my report text field.
    Be advised, I've not found documentation about the apex_application package of sufficient detail to allow me to comprehend exactly what gets put into the apex_application.g_fXX values or when, but based on what I've gathered from examples/blogs, I think it contains the report in the currently rendered page, but I honestly don't know.
    Given my assumptions, I'm expecting apex_application.g_f01(1) would be the first row item_id of my report and apex_application.g_f01(2) would be the first row c002 (qty from my collection) of my report. If this is correct, I would expect this would work.
    What might I have missed?
    Thanks!
    Paul
    PS. Honestly, is this methodology the only/easiest way to get my requirement/functionality to work? Is there an easier way?

    OK, tried this - not yet successful. This is what I've got.
    Classic report loaded by;
    declare
    l_query varchar2(4000) := '';
    begin
    l_query := 'select i.INVENTORY_ID, i.INVENTORY_ID inv_id_hold, col.c002, ql.QUANTITY_AVAILABLE, i.STRAIN_CODE, i.STRAIN_NAME, i.GENOTYPE, i.AGE, i.SEX, ql.ROOM_NUMBER from SM_INVENTORY i, SM_QUANTITY_LOCATION ql, apex_collections col where ql.STRAIN_ID = i.STRAIN_ID(+) and col.collection_name (+)= ''ORDER'' and col.c001 (+)= i.INVENTORY_ID';
    end;
    Created a "SAVE" button.
    Set up column inv_id_hold as a hidden tab form element and col.c002 as a text field tab form element (item_id and qty respectively). These should now be available as apex_application.g_f01 and apex_application.g_f02 (right?).
    I have this post submit plsql in a process conditioned to the "SAVE" button.
    declare col_item_count number;
    col_seq number;
    item_id number;
    qty number;
    begin
    if apex_collection.collection_exists('ORDER') = FALSE then
    apex_collection.create_collection( p_collection_name => 'ORDER');
    end if;
    for i in 1..apex_application.g_f01.count
    loop
    item_id := apex_application.g_f01(i);
    qty := apex_application.g_f02(i);
    select count(c001),seq_id into col_item_count, col_seq
    from apex_collections
    where c001 = apex_application.g_f01(i)
    and collection_name = 'ORDER';
    --group by c001, seq_id;*
    if col_item_count > 0 then
    apex_collection.update_member(
    p_collection_name => 'ORDER',
    p_seq             => col_seq,
    p_c001 => item_id,
    p_c002 => qty);
    else
    apex_collection.add_member(
    p_collection_name => 'ORDER',
    p_c001 => item_id,
    p_c002 => qty);
    end if;
    end loop;
    end;
    When I enter something in my qty column and press SAVE, I get "ORA-01403: no data found" being thrown by the plsql process (per debug). Since everything is going on "under the hood" and there is no step debugger in apex, I'm not able to see/understand the process in action and determine where the problem is occurring.
    I got the idea for all of this here - http://apex.oracle.com/pls/otn/f?p=39839:3:5596350954563087::NO which is the shopping cart page of the online store application. But I'm trying to get the quantity edit portion to work on the inventory listing (so a customer can add items to an order simply by providing qty input for a particular line item(s) and saving).
    Any advice?
    Can you write an order processing system in apex that uses a collection to store line items?

  • Problems using apex_application.g_fxx

    I have a SQL Query (updateable report) defined on a page and am using a custom app process to process the rows. I've based my code on posts out here but I'm getting some unusual results. Here's the sql for the report.
    SELECT
    NI_PROP_SEQ_NUM,
    NEW_ITEM_SEQ_NUM,
    APPROVED_REJECTED,
    APPROVED_REJECTED_BY,
    APPROVED_REJECTED_DATE,
    PROPOSAL_DATE,
    PROPOSAL_BY,
    PROP_FLD_LKUP_SEQ_NUM,
    PROPOSAL_FIELD_VALUE,
    case
    when PROP_FLD_LKUP_SEQ_NUM = 29 then
    (select nlsn_group_num || ' - ' || nlsn_ctgry_desc from apex_so.nlsn_ctgry where PROPOSAL_FIELD_VALUE = NLSN_CTGRY_NUM)
    else PROPOSAL_FIELD_VALUE
    end PROPOSED_VALUE
    from NI_PROPOSALS
    where NEW_ITEM_SEQ_NUM = :P2_NEW_ITEM_SEQ_NUM
    The report works fine on the page but when I try to process it using the following the values in the corresponding report don't align and is some cases I can't figure out where the values came from. Here's the code from the app process.
    DECLARE
    vRow BINARY_INTEGER;
    BEGIN
    :P2_RETURN_MESSAGE := 'This is a test, count = ' || apex_application.g_f01.COUNT;
    FOR i IN 1 .. apex_application.g_f01.COUNT
    LOOP
    vrow := apex_application.g_f01 (i);
    :P2_RETURN_MESSAGE := 'Inside the loop '
    || '. f01->'
    || apex_application.g_f01 (i)
    || '. f02->'
    || apex_application.g_f02 (i)
    || ' / f03->'
    || apex_application.g_f03 (i)
    || ' /f04-> '
    || apex_application.g_f04 (i)
    || ' / f05->'
    || apex_application.g_f05 (i)
    || ' / f06->'
    || apex_application.g_f06 (i)
    || ' / f07->'
    || apex_application.g_f07 (i);
    /* || ' / f08>'
    || nvl(apex_application.g_f08 (i), ' ');
    || ' / f09>'
    || nvl(apex_application.g_f09 (i), ' ')
    || ' / f10->'
    || nvl(apex_application.g_f10 (i), ' ')
    || ' / f11->'
    || nvl(apex_application.g_f12 (i), ' ')
    || ' / f12->'
    || nvl(apex_application.g_f12 (i), ' '); */
    END LOOP;
    END;
    There are 10 fields being selected in the sql above but if I try to concatenate more than g_f07 I get ora-1403 errors, data not found. None of these columns are null and I can't figure it out.
    Anyone have any thoughts?
    Thanks,
    Bruce

    Hi Bruce,
    is it possible that some of the columns are just of display type "Standard report column"? Because those will not save state.
    For an explanation of the apex_application.g_fxx array mapping, have a look at http://inside-apex.blogspot.com/2007/03/which-tabular-form-column-is-mapped-to.html
    Patrick
    *** New *** Oracle APEX Essentials *** http://essentials.oracleapex.info/
    My Blog, APEX Builder Plugin, ApexLib Framework: http://www.oracleapex.info/

  • [Solved] Reference apex_application.g_fXX in "execute immediate" statement

    Hi!
    I created a dynamically generated tabular form - the number of columns is not known in advanced. Each cell of the form is a text item generated with apex_item.text().
    I want to write an after-submit process that saves the values from the form into a database table. In this process I already know how many columns there are in the report so I want to do the following:
    --for each row...
    for i in 1..apex_application.g_f01.count loop
      -- and for each column in that row (number of columns is in v_col_count)
      for j in 1..v_col_count loop
        -- get the value of text item
        v_query := 'select apex_application.g_f0' || j || '(' || i || ')' || ' from dual';
        execute immediate v_query into v_value;
        -- now do some DML with v_value
      end loop;
    end loop;The problem is that I get an error: ORA-06553: PLS-221: 'G_Fxx' is not a procedure or is undefined where xx is the number from the generated query.
    My question is - am I doing something wrong or is is just not possible to reference apex_application.g_fxx in "execute immediate"? Will I have to manually check for all 50 possibilites of apex_application.g_fxx? Is there another way?
    TIA,
    Jure

    Well now I know what was wrong and what you were trying to tell me - apex_application.g_fxx is not visible in "plain" SQL. And now I also have a solution to this problem. The point is to wrap the select statement with begin - end block so that the statement is rendered as pl/sql:
    --for each row...
    for i in 1..apex_application.g_f01.count loop
      -- and for each column in that row (number of columns is in v_col_count)
      for j in 1..v_col_count loop
        -- get the value of text item
        v_query := 'begin select apex_application.g_f0' || j || '(:i)' || ' into :x from dual; end;';
        execute immediate v_query using i, out v_value;
        -- now do some DML with v_value
      end loop;
    end loop;This works great :).
    Jure

  • Use APEX_APPLICATION in an application process called by a javascript

    I have a page that is split into two; Top portion is a form, and the bottom part is a tabular form of a collection. Currently, if I enter information into the form and the collection and then submit the collection (to save the data to the collection) it erases the information in the form (since submitting for the form is separate). The same thing happens when I attempt to delete certain rows from the collection.
    My solution to this problem was to use javascript to call an application process (that way the page isn't completely refreshed, only the collection portion). However, I can't seem to get the apex package APEX_APPLICATION to work correctly as an application process (works fine as a process on submit as a page process).
    Below is the way I use apex_application for saving:
    begin
    for x in 1..apex_application.g_f03.COUNT
    loop
    apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
    p_seq => apex_application.g_f03(x),
    p_attr_number => 8,
    p_attr_value => apex_application.g_f08(x));
    apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
    p_seq => apex_application.g_f03(x),
    p_attr_number => 9,
    p_attr_value => apex_application.g_f09(x));
    apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
    p_seq => apex_application.g_f03(x),
    p_attr_number => 10,
    p_attr_value => apex_application.g_f10(x));
    apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
    p_seq => apex_application.g_f03(x),
    p_attr_number => 11,
    p_attr_value => apex_application.g_f11(x));
    apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
    p_seq => apex_application.g_f03(x),
    p_attr_number => 12,
    p_attr_value => apex_application.g_f12(x));
    end loop;
    end;
    Below is the code I use for deleting certain elements from the collection:
    BEGIN
    FOR ii IN 1 .. apex_application.g_f01.COUNT -- checkbox
    LOOP
    apex_collection.delete_member (p_collection_name => 'SPECIES_COLLECTION',
    p_seq => apex_application.g_f01(ii)
    END LOOP;
    APEX_COLLECTION.RESEQUENCE_COLLECTION('SPECIES_COLLECTION');
    END;
    Below is the javascript I attempted to use for application process for submitting:
    function addToCollection()
    var get =
    new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=submitLandings',0);
    gReturn = get.get();
    get = null;
    }

    Your requirement is quite similar to what I have here:
    http://apex.oracle.com/pls/otn/f?p=31517:159
    Using apex_application.g_fxx will not work in the way you originaly planed to do that since an application process can't see it.
    What you can do is to use an application process to update the collection at the moment you enter your data. Apply for an account (see login page of my demo application) and you may see how I solved it in my example.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • 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

  • Working with APEX_APPLICATION.GFXX

    Hello,
    I have created a series of checkboxes on my page. When the page is submitted I loop through the apex_application.GF01 array to see which of check boxes has been set.
    FOR I in 1..APEX_APPLICATION.G_F01.COUNT LOOP
    update mytable set status = 'CHECKED' where my_id = to_number(APEX_APPLICATION.G_F01(i));
    END LOOP;
    I would like to be able to also update the table based on what is not on the list, so would like to do something like this;
    update mytable set status='UNCHECKED' where my_id not in ( select <INSERT ALL VALUES FROM ARRAY> from dual);
    Can somebody please guide me on how to select out of this array... do I just need to create another type and select out of that, or is there a simple way that I am unaware of.
    Thanks
    Ben

    Hi Ben,
    in the case if you can't just issue an UPDATE mytable SET STATUS='UNCHECKED' before you process the array, take a look at the following thread. I think that is very similar to your problem. Re: Number of currently displayed rows in report with pagination?
    Hope that helps
    Patrick
    Check out my APEX-blog: http://inside-apex.blogspot.com

  • Problem with Apex_application.f01(i),Apex_application.f02(i),

    Hi,
    I have written Apex_item.check box,apex_item.text in SQL query,so i got check box and text item to each row in a report..
    here my requirement is that i should pass text item value which has enable the check box so in Process i have written code like..
    FOR i IN 1 .. APEX_Application.g_f01.COUNT
    LOOP
    apps.napp_start_ir_pkg.generate_report_data(APEX_Application.g_f01(i)
    ,APEX_Application.g_f02(i)
    END LOOP;
    COMMIT;
    Here the issue is I have enabled 5 check boxes randomly i.e row 1,5,6,8,9 and entered values in a text item respectively after that i click submit button.so here APEX_Application.g_f02(i) are passing null values to the procedure..
    How can i pass text values to procedure?
    I have been facing this problem for a 10 days..can you please guide me how to write code in process for passing the text values also..
    Thanks in advance...
    Regards
    Narender B

    Bob37 wrote:
    I can't imagine how that would work. I can only repeat what I said above in the reply Posted: Nov 11, 2011 3:26 PM Your solution should work, however not in all cases; certainly not without restricting the tabular form (specifically, removing the ability for the user to re-order fields)
    You should have values in g_f02 after submit, but you can't access G_f02 using "g_f02(i)"
    'i' will be equal to 1,2,3,4,5 and you need (1,5,6,8,9) which are the row numbers of the checked checkboxes.
    Absolutely right
    To resolve that bit, your code should be
    FOR i IN 1 .. APEX_Application.g_f01.COUNT
    LOOP
    apps.napp_start_ir_pkg.generate_report_data(APEX_Application.g_f01(i)
    ,APEX_Application.g_f02(Apex_application.g_f01(i))
    END LOOP;
    COMMIT;Note the G_f02 array access difference using g_f02(Apex_application.g_f01(i)) instead of g_f02(i)
    In other words, and in your example,
    Apex_application.g_f01(1) = 1
    Apex_application.g_f01(2) = 5
    Apex_application.g_f01(3) = 6
    Apex_application.g_f01(4) = 8
    Apex_application.g_f01(5) = 9
    This is not entirely correct, specifically it would only be correct if the checkbox field f01 maps onto the relative row number (i.e. the row number in the form itself, rather than the query). The OP does not indicate exactly which value he has mapped to f01 - if he's using the SQL pseudocolumn rownum AND he's allowing the form to be re-ordered, he's going to be in for a nasty shock when rows start being updated randomly (the absolute rownum from the query is retained, thus when you re-order, this value jumps all over the place).
    It looks like he's mapped some sort of unique ID field onto f01, which I believe will not work either (because he still has the same problem - namely that the index for the array f02 won't necessarily match that of f01...
    Bearing in mind, I'm still using 3.x, there might be an apex-specific row number which retains the relative row number value - typically, I map my checkbox field to a unique ID and use that to make updates, although I've not really implemented many forms that reference multiple page items in the way the OP wishes to.

  • Displaying the column values of a wizard-generated form

    Hello,
    I created a Master-Detail page following the examples in the various Apex guides. The form is not working correctly, unfortunately. When I click the Add Row button a row is added at the bottom of the table. Once I enter data into that row and click the Apply Changes button I get an SQL Insert error. I understand error message; a hidden column is not getting populated. Having said all that, that is not my problem.
    My problem is understanding how APEX is storing the data it displays in the table so I can manipulate it to place a value into that hidden column.
    I read many posts about how data is stored in the fxx arrays. I've looked at my source and have seen values like f02, f03, f03_0004 and so on. So, I tried creating a report to display the contents of APEX_APPLICATION.G_F03(1). I created another report on the same page with the following SQL statement:
    SELECT 'Code: '||apex_application.g_f03(1) F1
    FROM DUAL;
    When I run the page, the second report shows this: ORA-06553: PLS-221: 'G_F03' is not a procedure or is undefined.
    Someone (I think Denes) suggest creating a process with the following PL/SQL to help locate the correct array:
    BEGIN
    wwv_flow.debug('******************************');
    wwv_flow.debug('*** STARTING MY DEBUG HERE ***');
    wwv_flow.debug('1: ' || APEX_APPLICATION.G_F01(1));
    wwv_flow.debug('2: ' || APEX_APPLICATION.G_F02(1));
    wwv_flow.debug('3: ' || APEX_APPLICATION.G_F03(1));
    wwv_flow.debug('4: ' || APEX_APPLICATION.G_F04(1));
    wwv_flow.debug('5: ' || APEX_APPLICATION.G_F05(1));
    wwv_flow.debug('*** ENDING MY DEBUG HERE ***');
    wwv_flow.debug('******************************');
    END;
    With that process in place, whenever I run the page I get an error that says ORA-01403: no data found. When I comment out the five lines that reference APEX_APPLICATION.G_Fxx the page runs, but I cannot see the remaining debug comments UNLESS I place the process to run before or after the Footer.
    I hope that all makes sense.
    So, what am I doing wrong about displaying the contents of the array that is storing the table?
    Respectfully,
    Leon

    You can't reference a package variable in a SQL statement like you do in:
    SELECT 'Code: '||apex_application.g_f03(1) F1
    FROM DUAL;
    You can only reference it in a PL/SQL block (like you did in a Before/After Footer process). If you try to use the variables before they are instantiated you'll get the no-data-found error.

  • Show custom Error message in MB_CHECK_LINE_BADI

    Hi to all!
    I'm using MB_CHECK_LINE_BADI to make some validation before posting the document.
    The problem is this:
    When I try to show an E message from a Z message ID, te message isn't shown correctly.
    For example:
    if sy-subrc <> 0.
    v_txt = 'ERROR'.
        message E001 (Z_MSG) with v_txt.
    endif.
    Message ID Z_MSG, Message Number 001 = 'This is an example of an'.
    The message is show like this: S:Z_MSG: ERROR
    instade of This is an example of an ERROR.
    I realize that the only E messages that are shown correctly are those which Message ID and Message number are in the T159F table.
    Does any one knows if I have to update tihs standard table and how?
    Or how can I do to show my E messages correctly?
    Thanks a lot!
    Nico.-

    Hi,
    Yes, you can do that. You would need to create a page validation that loops through the records in the tabular form, checks the values entered and then returns an error message.
    Create a new validation. Set it to a Page level validation, select PL/SQL and then Function returning error text, then give it a name. The PL/SQL will be something like:
    BEGIN
    FOR i IN 1..APEX_APPLICATION.G_F01.COUNT
    LOOP
      IF TO_NUMBER(APEX_APPLICATION.G_F04(i)) > 100 THEN
       RETURN 'Item ' || TO_CHAR(i) || ' - DEPTSAL must not be greater than 100';
      END IF;
    END LOOP;
    RETURN NULL;
    END;This will loop through the records in column 4 and check the amount. If it is greater than 100, an error message is generated displaying the row with the error. This will stop the process on the first error. If there are no errors NULL is returned which indicates that the validation test has passed.
    You should replace G_F04 with the correct column for your page - do a View Source on the loaded page and check for the "name" attribute for the column. G_F04 is for "f04", G_F05 is for "f05" etc.
    Andy

Maybe you are looking for

  • How do i update to ipod software version 1.2.2

    i am using windows xpsp2 with itunes 7.5 and an 80 gb 5.5 generation ipod. When I synced my ipod today, i got a message saying that a new version is availible (version 1.2.2). I clicked ok, it synced but did not update to the new version. Now when I

  • 9.0.1 iTunes better than 8, BUT

    Basically, the same problems that existed with iTunes 8 exist with iTunes 9.0.1 with regards to 2nd gen Shuffle. However, it does work a little better, if you don't mind NEVER getting to pick what you put on the iPOD. The method for using iTunes 9.0.

  • TypeError: Error #1009: How do I find the exact line of the error?

    I got the following error when testing a project: [SWF] ProjectZ_iOS.swf - 12154544 bytes after decompression TypeError: Error #1009: Cannot access a property or method of a null object reference.                 at ProjectZ_iOS_fla::MainTimeline/goB

  • ITunes 11.3.1 doesn't recognize my iPhone but my computer does?

    I just recently downloaded iTunes 11.3.1 to my laptop and I wanted to sync my music library onto my iPhone 4, but when I plug it in, only my computer recognizes it, not iTunes. I've tried about everything on the site and nothing's worked so far. I've

  • DUMP Applications for E-Recruiting

    Dear I have an issue with register of external candidate. I have checked the log generated in the T.code ST22 and this genera error in the line 108 of the following class. CL_HRASR00_CREATE_PERS_FILE=>CREATE_APPEND_PERS_FILE   101   102 * Get the per