FOR i IN 1..htmldb_application.g_f01.COUNT LOOP

Hello,
I have created a report query as below
SELECT
ROWNUM,
x.household_org_affil_id,
x.hoaf_effective_date,
x.hoaf_terminate_date,
x.partner_organization,
x.primary_type,
x.relationship_type ,
x.affiliated_person_id,
x.chksum,
x.del
FROM (SELECT
htmldb_item.hidden(1,household_org_affil_id) household_org_affil_id,
wwv_flow_item.date_popup(2,NULL,vbhoaf.effective_date) hoaf_effective_date,
wwv_flow_item.date_popup(3,NULL,vbhoaf.terminate_date) hoaf_terminate_date,
htmldb_item.display_and_save(4,partner_common_name) partner_organization,
htmldb_item.HIDDEN(5,affiliated_person_id) affiliated_person_id,
htmldb_item.display_and_save(6,primary_type) primary_type,
htmldb_item.display_and_save(7,relationship_type_dis) relationship_type,
htmldb_item.md5_checksum(
household_org_affil_id,
vbhoaf.effective_date,
vbhoaf.terminate_date) chksum,
htmldb_item.checkbox(50, household_org_affil_id, (case when vbhoaf.terminate_date is null then 'DISABLED' else NULL end)) del
FROM vb_household_org_affil vbhoaf
JOIN vb_household_membership vbhm
ON vbhoaf.family_household_id = vbhm.family_household_id
JOIN vb_partner_organization vbpo
ON vbpo.partner_organization_id = vbhoaf.partner_organization_id
WHERE :P1580_AFFILIATED_PERSON_ID IS NOT NULL
AND vbhm.affiliated_person_id = :P1580_AFFILIATED_PERSON_ID) x
But if I am trying to loop as below
FOR i IN 1 .. htmldb_application.g_f01.COUNT LOOP
I am getting an error 'no data found' as like the array g_f01 does not exist. But If I am refering g_f02, that is ok but that is not the one I want.
Can you anyone please help me to find what is wrong.
Thanks in advance,
Nattu

Hello Nattu,
Although it seems that your query is working in the way you wrote it, I believe it makes more sense (at least for me) that the use of the APEX API will be within the main query and not within the sub-query.
In your case, as you created the household_org_affil_id column as hidden one, you probably don’t want to display it. Did you uncheck the “Show” attribute for this column? In this case the column don’t get to be POSTed, and the corresponding G_Fxx array will be empty.
In order to correct that, and still get a presentable report, you need to concatenate the hidden column with a column you are displaying. This way the hidden values will be populated to the corresponding G_Fxx array. You can try something like this:
SELECT ROWNUM
htmldb_item.hidden(1,household_org_affil_id) ||
wwv_flow_item.date_popup(2,NULL,vbhoaf.effective_date) hoaf_effective_date,
from (select  x.hoaf_effective_date, . . .
           from vb_household_org_affil vbhoaf x
           where . . . )
@ ines:
There isn’t any problem to use G_F01 to accommodate a hidden column. The example in the documentation is doing just that - http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/api.htm#sthref2857 .
Hope this helps,
Arie.

Similar Messages

  • FOR I IN 1..HTMLDB_APPLICATION.G_F01.COUNT

    I cannot seem to get row processing (using G_Fxx.count) to work property.
    I have followed the HOWTO section to create an updateable report with a Checkbox. On Load, all checkboxes are set to UNCHECKED:
    SELECT X.OFFICER_ID
    , X.OFFICER_NAME_TX
    , X.OFFICER_TITLE_TX
    FROM (
    SELECT HTMLDB_ITEM.CHECKBOX(1,'N',NULL,'Y')
    || HTMLDB_ITEM.HIDDEN(2,OFFICER_ID) OFFICER_ID
    , HTMLDB_ITEM.TEXT(3,OFFICER_NAME_TX) OFFICER_NAME_TX
    , HTMLDB_ITEM.TEXT(4,OFFICER_TITLE_TX) OFFICER_TITLE_TX
    FROM CDIS_INV_OFFICER
    WHERE CORONER_CASE_ID = :P1_CORONER_CASE_ID
    UNION ALL
    SELECT HTMLDB_ITEM.CHECKBOX(1,'N',NULL,'Y')
    || HTMLDB_ITEM.HIDDEN(2,NULL) OFFICER_ID
    , HTMLDB_ITEM.TEXT(3,NULL) OFFICER_NAME_TX
    , HTMLDB_ITEM.TEXT(4,NULL) OFFICER_TITLE_TX
    FROM ALL_OBJECTS WHERE ROWNUM <= NVL(:P2_ADD_OFFICER_CNT, 0)) X
    I attempt to loop through the looped rows and upate the Officer Name and Title for those rows checked.
    BEGIN
    -- Loop through the rows that have been checked.
    FOR I IN 1..HTMLDB_APPLICATION.G_F01.COUNT
    LOOP
    -- Update the Officer Name and Title if checked.
    CDIS$CDIS_INV_OFFICER_U.P_UPDATE_BY_OFFICER_ID
    ( HTMLDB_APPLICATION.G_F02(I)
    , :P1_CORONER_CASE_ID
    , REPLACE(HTMLDB_APPLICATION.G_F03(I),'%'||'NULL%',NULL)
    , REPLACE(HTMLDB_APPLICATION.G_F04(I),'%'||'NULL%',NULL)
    , :F118_STATUS_CD
    , :F118_STATUS_DESC ) ;
    END IF ;
    END LOOP;
    EXCEPTION
    WHEN OTHERS THEN
    :F118_STATUS_CD := '1' ;
    :F118_STATUS_DESC := SUBSTR((SQLERRM),1,2000);
    END ;
    If I check row 1 and 3 and hit the UPDATE button, rows 1 and 2 get updated. If I check rows 1, 3, 5, 7 and 9, then rows 1 to 5 get updated.
    From what I can determine, all that FOR I IN 1..HTMLDB_APPLICATION.G_F01.COUNT holds is the count of the rows update. Then when I loop through, I update the FIRST X-many rows. So, if 5 rows are checked, the first 5 rows are updated.
    What exactly am I doing wrong?

    Vivek thanks for helping find the solution.
    I see that there are several threads on this topic – having to do with updateable reports, checkboxes and hidden columns (most likely the Primary Key or parts of the Primary Key). Maybe I should write a HOWTO, but here first is the solution for those that are currently experiencing this problem.
    First let me address the value contained within HTMLDB_APPLICATION.G_F01.COUNT:
    G_F01.COUNT contains the number of rows checked. It does not identify those rows. Meaning, if you have 3 rows checked this variable will contain the number 3. If you use this variable in a LOOP Statement (i.e. "FOR i IN 1..HTMLDB_APPLICATION.G_F01.COUNT") the variable "i" will start at 1 and be incremented by 1 until it gets to 3. So, the values will be 1, 2 and 3.
    If you then reference HTMLDB_APPLICATION.G_F03(i), you will reference the 3rd column in the array for rows 1, 2 and 3. This is not necessarily the checked rows. Meaning if rows 1, 3 and 5 are checked and then HTMLDB_APPLICATION.G_F03(i) is referenced in the loop, the wrong rows will be referenced.
    The solution is "not to reference HTMLDB_APPLICATION.G_F03(i)" but instead "to reference HTMLDB_APPLICATION.G_F03(HTMLDB_APPLICATION.G_F01(i))".
    Within my Region Definition, I have:
    SELECT HTMLDB_ITEM.CHECKBOX(1,ROWNUM)
    _______, X.Officer_Name
    _______, X.Officer_Title
    FROM (
    SELECT HTMLDB_ITEM.HIDDEN(2,Officer_Id)
    ______|| HTMLDB_ITEM.TEXT(3,Officer_Name) Officer_Name
    ______, HTMLDB_ITEM.TEXT(4,Officer_Title) Officer_Title
    FROM  CDISINV_OFFICER
    WHERE Coroner_Case_Id = :P1_CORONER_CASE_ID ) X
    The Checkbox is stored in F01. The Hidden Primary Key is stored in F02 (if there were multiple columns in the Primary Key, one would have multiple hidden columns and multiple associated F##s). The updateable report columns are stored in F03 and F04.
    Within my "After Update" Process (On Submit – After Computations and Validations), I have:
    BEGIN
    FOR I IN 1..HTMLDB_APPLICATION.G_F01.COUNT
    LOOP
    UPDATE CDIS_INV_OFFICER
    ____SET Officer_Name = HTMLDB_APPLICATION.G_F03(HTMLDB_APPLICATION.G_F01(i))
    _______, Officer_Title = HTMLDB_APPLICATION.G_F04(HTMLDB_APPLICATION.G_F01(i))
    WHERE Coroner_Case_Id = :P1_CORONER_CASE_ID
    ___AND Officer_Id = HTMLDB_APPLICATION.G_F02(HTMLDB_APPLICATION.G_F01(i)) ;
    END LOOP;
    Notice that I am referencing F03(F01(i)) and not F03(i).
    Instead of going F03(1), F03(2) then F03(3), I am actually referencing the rows associated with the checkboxes.
    This is how the Checked Rows (where the CHECKBOX is set to “Enabled”) are selected, via the ROWNUM stored within the Regional Definition.
    This solution works well.
    I hope you find my explanation helpful.

  • Updating 2 distinct regions with "for i in 1..htmldb_application.g_f01.coun

    I have 2 different queried regions (PL/SQL Function returning Query). I want to use one SAVE button to save all values in both regions. One is a student's SAT scores, the other is their ACT scores. They reference 2 distinct tables, sat and act.
    The problem seems to be that the regions share the f01, etc. identifiers. I tried to get around this by making f01 indicate which test it is, ie. which table to update.
    I'm using the "for i in 1..htmldb_application.g_f01.count loop" construct. It works fine when only 1 of the regions has records. But when they both have rows i get this error: ORA-01403: no data found... apparently not retrieving the records? Here is my process code, which is executed when the SAVE button is pressed:
    -- There are 2 regions, SAT and ACT. Since they share form identifiers
    -- (f02, etc.) the Test Type was needed to distinguish which table to insert
    -- the values into, sat or act.
    -- SAT
    -- f01 = Test Type ( = SAT )
    -- f02 = permnum
    -- f03 = SAT admindate
    -- f04 = SAT testsite
    -- f05 = SAT math
    -- f06 = SAT verbal
    -- f07 = SAT composite
    -- ACT
    -- f01 = Test Type ( = ACT )
    -- f02 = ACT permnum
    -- f03 = ACT admindate
    -- f04 = ACT testsite
    -- f05 = ACT math
    -- f06 = ACT english
    -- f07 = ACT reading
    -- f08 = ACT science
    -- f09 = ACT composite
    begin
    for i in 1..htmldb_application.g_f01.count
    loop
    if htmldb_application.g_f01(i) = 'SAT' then
    update sat
    set testsite = htmldb_application.g_f04(i),
    math = replace(htmldb_application.g_f05(i), '', NULL),
    verbal = replace(htmldb_application.g_f06(i), '', NULL),
    composite = replace(htmldb_application.g_f07(i), '', NULL)
    where permnum = :GLOBAL_PERMNUM
    and to_char(admindate, 'DD-MON-YYYY') = htmldb_application.g_f03(i);
    end if;
    if htmldb_application.g_f01(i) = 'ACT' then
    update act
    set testsite = htmldb_application.g_f04(i),
    math = replace(htmldb_application.g_f05(i), '', NULL),
    english = replace(htmldb_application.g_f06(i), '', NULL),
    reading = replace(htmldb_application.g_f07(i), '', NULL),
    science = replace(htmldb_application.g_f08(i), '', NULL),
    composite = replace(htmldb_application.g_f09(i), '', NULL)
    where permnum = :GLOBAL_PERMNUM
    and to_char(admindate, 'DD-MON-YYYY') = htmldb_application.g_f03(i);
    end if;
    end loop;
    end;

    Ok i broke them out into 2 separate processes, with a Save button in each region "SAVE_SAT" and "SAVE_ACT". Like this:
    // | PROCESS: Save Changes to SATs |
    -- There are 2 regions, SAT and ACT. Since they share form identifiers
    -- (f02, etc.) the Test Type was needed to distinguish which table to insert
    -- the values into, sat or act.
    -- SAT
    -- f01 = Test Type ( = SAT )
    -- f02 = permnum
    -- f03 = SAT admindate
    -- f04 = SAT testsite
    -- f05 = SAT math
    -- f06 = SAT verbal
    -- f07 = SAT composite
    begin
    for i in 1..htmldb_application.g_f01.count
    loop
    if htmldb_application.g_f01(i) = 'SAT' then
    update sat
    set testsite = htmldb_application.g_f04(i),
    math = replace(htmldb_application.g_f05(i), '', NULL),
    verbal = replace(htmldb_application.g_f06(i), '', NULL),
    composite = replace(htmldb_application.g_f07(i), '', NULL)
    where permnum = :GLOBAL_PERMNUM
    and to_char(admindate, 'DD-MON-YYYY') = htmldb_application.g_f03(i);
    end if;
    end loop;
    end;
    // | PROCESS: Save Changes to ACTs |
    -- ACT
    -- f01 = Test Type ( = ACT )
    -- f02 = ACT permnum
    -- f03 = ACT admindate
    -- f04 = ACT testsite
    -- f05 = ACT math
    -- f06 = ACT english
    -- f07 = ACT reading
    -- f08 = ACT science
    -- f09 = ACT composite
    begin
    for i in 1..htmldb_application.g_f01.count
    loop
    if htmldb_application.g_f01(i) = 'ACT' then
    update act
    set testsite = htmldb_application.g_f04(i),
    math = replace(htmldb_application.g_f05(i), '', NULL),
    english = replace(htmldb_application.g_f06(i), '', NULL),
    reading = replace(htmldb_application.g_f07(i), '', NULL),
    science = replace(htmldb_application.g_f08(i), '', NULL),
    composite = replace(htmldb_application.g_f09(i), '', NULL)
    where permnum = :GLOBAL_PERMNUM
    and to_char(admindate, 'DD-MON-YYYY') = htmldb_application.g_f03(i);
    end if;
    end loop;
    end;
    Now, i can save SAT information (for that region), but i get this error when i try to save changes to the ACT region:
    ORA-01403: no data found
    ?

  • Using HTMLDB_APPLICATION.G_F01 in a stored procedure

    I have a page with pl/sql function returning sql query report. The query works fine and produces a report with check boxes. The query looks like this:
    SELECT HTMLDB_ITEM.CHECKBOX(1,material_code) export,
    material_code, COUNT(*)
    AS letters FROM du_materials
    WHERE ... long where clause.
    The query produces a nice report with checkboxes.
    I placed a region button on the page which redirects to this URL:
    #OWNER#.du_mailmerge.write_materials?user_id=871010501&one_many=MANY
    The purpose of this stored procedure is to produce a file download.
    The stored procedure looks like this:
    PROCEDURE write_materials(user_id IN VARCHAR2,
    one_many IN VARCHAR2) IS
    BEGIN
    FOR i IN 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
    IF HTMLDB_APPLICATION.G_F01(i) IS NOT NULL THEN
    write_mime_header(file_name=>HTMLDB_APPLICATION.G_F01(i) || '.csv');
    write_table_data(HTMLDB_APPLICATION.G_F01(i));
    END IF;
    END LOOP;
    END write_materials;
    When I run the application and click the button, I get a blank page in the browser. Before I tried this, I used simple code that did not reference HTMLDB_APPLICATION and it worked fine. I have run some debugging code in the above procedure and find that HTMLDB_APPLICATION.G_F01.COUNT appears to be null or zero. There are no errors in the apache error log.
    I have tried replacing HTMLDB_APPLICATION.G_F01.COUNT with
    v('G_F01.COUNT'), that does not work either.
    What's wrong? Is my syntax bad? Is the array not available to a stored procedure?

    Thanks much for your response. I was afraid of that.
    I quess I will have to go with this fallback plan:
    1. put code in page process to create file use UTL_FILE.
    2. Using the techniques in the How-to file export/import, import the whole file to clob, then export it.
    3. delete import from table
    4. return to my page.
    This forum is great. Thanks to everyone who reads and responds to us newbies with HTML DB.

  • Htmldb_application array count 0 when it shouldn't be

    This was working until I made modifications to the application, i.e. tabs, menus and such. It uses a manually built tabular form - that part works and displays with correct values, but when I try to access the array with a loop it appears to be empty.
    I also have an item P3_WHERE_CLAUSE that runs a similar loop to build a where clause for validation. I modified it to debug as shown below.
    Any hints greatly appreciated - can't figure out how I broke it.
    Here's the query for the tabular form:
    select
    htmldb_item.select_list_from_query(
    1,key_id,
    'select key_id, object_key from
    val_object_key k,
    VAL_OBJECT o
    where o.object_name = :P3_OBJECT_NAME
    and k.object_id = o.object_id') Key_id,
    htmldb_item.select_list_from_query(2,object_key,
    'select object_key, object_key from
    val_object_key k,
    VAL_OBJECT o
    where o.object_name = :P3_OBJECT_NAME
    and k.object_id = o.object_id') Key,
    htmldb_item.text(3,'',50) Value
    from VAL_OBJECT_KEY k,
    VAL_OBJECT o
    where o.object_name = :P3_OBJECT_NAME
    and k.object_id = o.object_id;
    Here's the code to save the page information (several items in a cascading form and then it loops to include values from the tabular form). The loop does not execute.
    DECLARE P_KEY_ID NUMBER;
    kvs_id NUMBER;
    BEGIN
    select prov_id.nextval into kvs_id from dual;
    insert into key_val_set kvs_id values (kvs_id);
    for i in 1..htmldb_application.g_f01.count
    loop
    insert into key_value (KV_ID,KEY_ID,KEY_VALUE,KVS_ID)
    values
    prov_id.nextval,
    htmldb_application.g_f01(i),
    htmldb_application.g_f03(i),
    kvs_id)
    end loop;
    INSERT INTO PROV_INSTANCE
    CLASS_ID,
    SOURCE_ID,
    DATE_OCCURED,
    KVS_ID
    VALUES
    :P3_CLASS_NAME,
    :P3_SRC_NAME,
    :P3_DATE_OCCURED,
    kvs_id
    commit;
    END;
    Here's the test loop:
    begin
    :P3_WHERE_CLAUSE := 'begin test';
    for i in 1..htmldb_application.g_f01.count
    loop
    :P3_WHERE_CLAUSE := 'where '||i;
    end loop;
    return :P3_WHERE_CLAUSE;
    end;

    Never mind - it was a page flow misunderstanding.

  • HTMLDB_APPLICATION.G_F01 has wrong value!

    HTMLDB_APPLICATION.G_F01 has wrong value!
    Hello again,
    I have a search page in my app (here the user defines the search criteria) P1.
    The page branches to P130, where the result is shown. This second page contains a region of type 'SQL Query (PL/SQL Function Body Returning SQL Query)'. The code for this dynamic query is 231 lines of code, so I want to spare you scrolling through it here . What it basically does is generating SQL QRY's such as the following:
    select     distinct(sq.SAMPLE_ID) XXX,
    'ID: '||sq.SAMPLE_ID||'
    ' ||'Type: '||sq.SAMPLE_TYPE||'
    ' ||'Collection Date: '||sq.COLLECTION_DATE SAMPLE_INFO,
    'Aliquots (T/A): '||to_char(sq.ALIQUOTS_TOTAL)|| '/' ||to_char(sq.ALIQUOTS_AVAILABLE)||'
    ' ||'Volume (T/A): '||to_char(sq.VOLUME_TOTAL,'990D00')|| '/' ||to_char(sq.VOLUME_AVAILABLE,'990D00') AVAILABILITY,
    'Age: '||sq.PATIENT_AGE||'
    ' ||'Gender: '||sq.PATIENT_SEX||'
    ' ||'Bloodtype: '||sq.BLOOD_TYPE||'
    ' PATIENT_INFO,
    DML_SERVICE.get_Diagnoses(sq.SAMPLE_ID) DIAGNOSES,
    DML_SERVICE.get_Medications(sq.SAMPLE_ID) MEDICATIONS,
    DML_SERVICE.get_Interferences(sq.SAMPLE_ID) INTERFERENCES,
    DML_SERVICE.get_LabData(sq.SAMPLE_ID) LABDATA,
    decode(to_char(sq.ALIQUOTS_AVAILABLE), '0', null, htmldb_item.text(1, '1', 1, 2)) ORDER_QTY,
    decode(to_char(sq.ALIQUOTS_AVAILABLE), '0', null, htmldb_item.checkbox(2,sq.SAMPLE_ID)) ORDER_ME
    from SEARCH_V01 sq
    where sq.DIAGNOSIS = 'D-Dimer'
    order by 1 desc
    The DML_SERVICE functions just return a string(Varchar2). At the right side of the report I have two columns, one with a textfield (ORDER_QTY, default: 1) and one with a checkbox (ORDER_ME) for each line.
    For each line where the checkbox is checked, a process (On Submit - after Comp and Val) places the order for the requested quantity (this is done by inserting an Order ID into the ALIQUOTS table -> see bold update statement below).
    The process follows:
    declare
    alq_qty number;
    alq_id number;
    cnt number;
    begin
    cnt := 0;
    for i in 1..HTMLDB_APPLICATION.G_F02.count
    loop
    select count(*) -- set alq_qty to number of available alq's
    into alq_qty
    from ALIQUOTS a
    where a.SAMPLE_ID = HTMLDB_APPLICATION.G_F02(i)
    and a.ORDER_ID = 0;
    insert into D_DEBUG (ID, DD) values (1, 'wanted: ' || HTMLDB_APPLICATION.G_F01(i) || ' available: ' || alq_qty); -- REMOVE!!!
    if alq_qty > to_number(HTMLDB_APPLICATION.G_F01(i)) then -- if there are enough alq's
    alq_qty := to_number(HTMLDB_APPLICATION.G_F01(i)); -- set alq_qty to number of ordered alq's
    end if;
    for n in 1..alq_qty
    loop
    select min(ID)
    into alq_id
    from ALIQUOTS
    where sample_id = HTMLDB_APPLICATION.G_F02(i)
    and order_id = 0;
    insert into D_DEBUG (ID, DD) values (1, 'alq_id: '||alq_id); -- REMOVE!!!
    update ALIQUOTS
    set order_id = :P130_SELECT_ORDER
    where id = alq_id;
    cnt := cnt + 1;
    end loop;
    dml_service.upd_sample_record(HTMLDB_APPLICATION.G_F02(i)); -- refresh data in SAMPLE table
    end loop;
    :P130_MSG := 'Assigned '||cnt||' aliquots to order: '||:P130_SELECT_ORDER;
    end;
    Now my problem is that this process does what it should, sometimes. When I enter 6 in one row and check the checkbox and enter 4 in another row and check that checkbox and then press SUBMIT, 10 aliquots are assigned to my order.
    Sometimes.... the other times the process just orders 2 aliquots, one of each line and disregards the number entered in the textfield.
    Or so it may seem: I added some lines to write debug info into D_DEBUG (see above.) From those entries you can assume that the content of HTMLDB_APPLICATION.G_F01(i) is in fact '1' when the process does its work. So I think the problem lies somewhere in the creation of htmldb_item.text(), (I went through the API of that htmldb_item again and again...)
    Also: I can reproduce / recreate this error. It's totally weird: for some rows it (always) works and for some it (always) doesn't !!!
    So, any help, any suggestion is really appreciated (I'm currently working on bringing the crucial part of this to marvel.oracle.com)
    -David-
    [Edited by: sleuniss on Jul 15, 2004 12:18 PM]
    Changed subject line.

    Now the subjectline is right, but the indentation is gone.... :-(
    again the SQL query:
    select     distinct(sq.SAMPLE_ID) XXX,
               'ID: '||sq.SAMPLE_ID||'
    ' ||'Type: '||sq.SAMPLE_TYPE||'
    ' ||'Collection Date: '||sq.COLLECTION_DATE SAMPLE_INFO,
               'Aliquots (T/A): '||to_char(sq.ALIQUOTS_TOTAL)|| '/' ||to_char(sq.ALIQUOTS_AVAILABLE)||'
    ' ||'Volume (T/A): '||to_char(sq.VOLUME_TOTAL,'990D00')|| '/' ||to_char(sq.VOLUME_AVAILABLE,'990D00') AVAILABILITY,
               'Age: '||sq.PATIENT_AGE||'
    ' ||'Gender: '||sq.PATIENT_SEX||'
    ' ||'Bloodtype: '||sq.BLOOD_TYPE||'
    ' PATIENT_INFO,
               DML_SERVICE.get_Diagnoses(sq.SAMPLE_ID) DIAGNOSES,
               DML_SERVICE.get_Medications(sq.SAMPLE_ID) MEDICATIONS,
               DML_SERVICE.get_Interferences(sq.SAMPLE_ID) INTERFERENCES,
               DML_SERVICE.get_LabData(sq.SAMPLE_ID) LABDATA,
               decode(to_char(sq.ALIQUOTS_AVAILABLE), '0', null, htmldb_item.text(1, '1', 1, 2)) ORDER_QTY,
               decode(to_char(sq.ALIQUOTS_AVAILABLE), '0', null, htmldb_item.checkbox(2,sq.SAMPLE_ID)) ORDER_ME
    from     SEARCH_V01 sq
    where  sq.DIAGNOSIS = 'D-Dimer'
    order    by 1 desc
    and the process:
    declare
       alq_qty number;
       alq_id number;
       cnt number;
    begin
       cnt := 0;
       for i in 1..HTMLDB_APPLICATION.G_F02.count
       loop
          select count(*) -- set alq_qty to number of available alq's
           into alq_qty
           from ALIQUOTS a
           where a.SAMPLE_ID = HTMLDB_APPLICATION.G_F02(i)
           and a.ORDER_ID = 0;
    insert into D_DEBUG (ID, DD) values (1, 'wanted: ' || HTMLDB_APPLICATION.G_F01(i) || ' available: ' || alq_qty); -- REMOVE!!!
          if alq_qty > to_number(HTMLDB_APPLICATION.G_F01(i)) then -- if there are enough alq's
             alq_qty := to_number(HTMLDB_APPLICATION.G_F01(i)); -- set alq_qty to number of ordered alq's
          end if;
          for n in 1..alq_qty
          loop
             select min(ID)
              into alq_id
              from ALIQUOTS
              where sample_id = HTMLDB_APPLICATION.G_F02(i)
              and order_id = 0;
    insert into D_DEBUG (ID, DD) values (1, 'alq_id: '||alq_id); -- REMOVE!!!
             update ALIQUOTS
              set order_id = :P130_SELECT_ORDER
              where id = alq_id;
             cnt := cnt + 1;
          end loop;
          dml_service.upd_sample_record(HTMLDB_APPLICATION.G_F02(i)); -- refresh data in SAMPLE table
       end loop;
       :P130_MSG := 'Assigned '||cnt||' aliquots to order: '||:P130_SELECT_ORDER;
    end;
    -David-

  • How do we reference report output (E.G.htmldb_application.g_F01.)?

    Hi there,
    We are trying to reference data returned by a query using an array statement such as XX := htmldb_application.g_F01.count;
    The value is always zero. Are we missing something?
    Thanks

    Hi Scott,
    Correct.
    We have say 2 columns FUND and EXCEL_FUND. A snippet of the query would look like;
    select a.segment1 fund, '="' || a.segment1 || '"' excel_fund.....
    they return 01 and ="01" for example.
    We conditionally display 01 on the on-screen report but we want to export ="01" to excel so the leading zeros are not stripped out.. The browser displays the report region data 01 correctly. But we cannot export ="01" as it appears that unless you display the value you cannot export it(version 3.1).
    So we have our own export to excel button which works if we re-run the query. But we do not want to re-run the query, we want to re-use the "result set" of the on-line report(sorry, i am not certain what all the terms are). Everyone seems to use the htmldb_application package but we don't know if the htmldb_application.g_F01 array item is loaded up by the app or do we have to do it? We are in a bit of a fog.
    Any help is appreciated.
    Thanks

  • Access htmldb_application.g_f01 from Report Query ?

    I want to have a search functionality built into the report itself, so, was trying to create a sql report as:
    select htmldb_item.hidden(1,null) empno,
    htmldb_item.text(2,null) ename,
    htmldb_item.select_list_from_query(3,null,'select distinct job, job from emp') job,
    htmldb_item.popupkey_from_query(4,null,'select ename, empno from emp',10) mgr
    from dual
    union all
    select empno, ename, job, mgr
    from emp
    where empno = NVL(htmldb_application.g_f01(1), empno)
    and ename = NVL(htmldb_application.g_f02(1), ename)
    However, this gives an error saying "ORA-06553: PLS-221: 'G_F01' is not a procedure or is undefined".
    I changed the radio button to parse query at runtime only to ensure that the collection gets created first, but even then during runtime it gives the same error. I tried to create two reports (to try conditional display) the first report contain the union clause, and the second report just containing select * from emp where empno = htmldb_appl....
    even this is giving error.
    Is there anyway to achieve this functionality ?

    Ok, I created hidden columns for :p1_empno, p1:ename, p1:job etc and in a submit process assigned them to the htmldb_application.g_f01, ...etc, and changed the query to
    from emp where empno = nvl(:p1_empno, empno) and ....
    this is working,
    (a)Is there any better way to do it instead of creating these hidden columns.
    (b)how can we toggle this htmldb_item.hidden, ..., row (search row) display ? clicking on an icon in the column header should either display this row and clicking it again should hide this row.

  • BAPI for goods moment is not working in loop

    Dear ABAPers,
    If i am using BAPI ( for MB1n transabtion for goods movement type 309 )with in loop first one is working fine and remaining is not working.
    If i run individually all r working fine.
    I am sending cdoe as below.
    Pl hava look on that.
      LOOP AT ITAB.
        CLEAR: GM_RETURN, GM_RETMTD,GM_HEADER,GM_CODE,GM_HEADRET.
        REFRESH: GM_RETURN,GM_ITEM.
        GM_HEADER-PSTNG_DATE = SY-DATUM.
        GM_HEADER-DOC_DATE   = SY-DATUM.
        GM_CODE-GM_CODE      = '04'.                            " MB1B
        CLEAR GM_ITEM.
        MOVE '309'                 TO GM_ITEM-MOVE_TYPE     .
        MOVE ITAB-MATNR  TO GM_ITEM-MATERIAL.
        MOVE ITAB-MENGE_REC TO GM_ITEM-ENTRY_QNT.
        MOVE ITAB-MATNR_REC TO GM_ITEM-MOVE_MAT.
        MOVE ITAB-MEINS_REC TO GM_ITEM-BASE_UOM.
        MOVE ITAB-WERKS_REC  TO GM_ITEM-PLANT.
        MOVE ITAB-LGORT_REC  TO GM_ITEM-STGE_LOC.
        MOVE ITAB-CHARG TO GM_ITEM-BATCH.
        MOVE ITAB-CHARG_REC TO GM_ITEM-MOVE_BATCH.
        APPEND GM_ITEM.
        CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
          EXPORTING
            GOODSMVT_HEADER  = GM_HEADER
            GOODSMVT_CODE    = GM_CODE
          IMPORTING
            GOODSMVT_HEADRET = GM_HEADRET
            MATERIALDOCUMENT = GM_RETMTD
          TABLES
            GOODSMVT_ITEM    = GM_ITEM
            RETURN           = GM_RETURN.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT          =
    IMPORTING
      RETURN        =
        IF GM_RETURN[] IS NOT INITIAL.
          LOOP AT GM_RETURN.
            IF GM_RETURN-TYPE = 'E'.
              ERR_CNT = ERR_CNT + 1.
              V_MESSAGE = GM_RETURN-MESSAGE.
              UPDATE Y_MB1B SET STS_CODE = 'PE'
                               UPDATE_BY = SY-UNAME
                               UPDATE_DATE = SY-DATUM
                               MESS = V_MESSAGE
                   WHERE SRL = ITAB-SRL.
            ENDIF.
          ENDLOOP.
        ELSE.
          IF GM_RETMTD IS NOT INITIAL.
            REC_CNT = REC_CNT + 1.
            CONCATENATE 'Document' GM_RETMTD 'posted' INTO V_MESSAGE SEPARATED BY SPACE.
            UPDATE Y_MB1B SET STS_CODE = 'PS'
                       UPDATE_BY = SY-UNAME
                       UPDATE_DATE = SY-DATUM
                       MESS = V_MESSAGE
           WHERE SRL = ITAB-SRL.
          ENDIF.
        ENDIF.
      ENDLOOP.
    Pl gimme solution.
    Cheers,
    Simha.

    Hi,
                   here is the code check this for ur ref
    method IF_EX_LE_SHP_GOODSMOVEMENT~CHANGE_INPUT_HEADER_AND_ITEMS .
    ******** Data Declaration *************
      data: ls_lips type lips.
      data: ls_goods_header type BAPI2017_GM_HEAD_01.
      data: ls_gm_code type BAPI2017_GM_CODE.
      data: ls_goods_mvt type BAPI2017_GM_ITEM_CREATE.
      data: lt_goods_mvt type table of BAPI2017_GM_ITEM_CREATE.
      data: lt_return type table of BAPIRET2.
      data:ls_MATERIALDOCUMENT type BAPI2017_GM_HEAD_02-MAT_DOC.
      data: ls_MATDOCUMENTYEAR type BAPI2017_GM_HEAD_02-DOC_YEAR.
      constants: c_bwart type lips-bwart value '309'.
      ls_goods_header-PSTNG_DATE = sy-datum.
      ls_goods_header-DOC_DATE   = IS_LIKP-bldat.
      ls_goods_header-pr_uname = sy-uname.
      ls_gm_code-GM_CODE         = '06'.
      loop at it_xlips into ls_lips
           where OIC_MOT = 'PK'.
        if ( ls_lips-uepos is initial and ls_lips-pstyv = 'TAQ').
          ls_goods_mvt-MATERIAL = ls_lips-MATNR.
          ls_goods_mvt-PLANT = ls_lips-WERKS.
          ls_goods_mvt-STGE_LOC = ls_lips-LGORT.
          ls_goods_mvt-MOVE_TYPE = c_bwart.
          ls_goods_mvt-ENTRY_QNT = ls_lips-LFIMG.
          ls_goods_mvt-MOVE_MAT = ls_lips-UMMAT.
          ls_goods_mvt-MOVE_PLANT = ls_lips-UMWRK.
          ls_goods_mvt-MOVE_STLOC = ls_lips-UMLGO.
          append ls_goods_mvt to lt_goods_mvt.
        endif.
      endloop.
    by this call function BAPI Material document is created ****
      data : LS_GOODSMVT_HEADRET     TYPE BAPI2017_GM_HEAD_RET.
      CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
        EXPORTING
          GOODSMVT_HEADER  = ls_goods_header
          GOODSMVT_CODE    = ls_gm_code
        IMPORTING
          GOODSMVT_HEADRET = LS_GOODSMVT_HEADRET
        TABLES
          GOODSMVT_ITEM    = lt_goods_mvt
          RETURN           = lt_return.
      IF lt_return[] is NOT initial.
    <b>Reward points</b>
    Regards

  • For...each...in loop.  Can I make assumptions about the order?

    I've always assumed that I can't make any assumptions about the order in which elements are indexed by a for...each...in loop.  Not even for a conventional indexed array.  (Emphasis!: I'm not talking about associative arrays here, I'm talking about normal indexed arrays.  Dense, no gaps.).
    for each (var element:ElementClass in myArray) {}
    May not traverse the array from first to last.  I've never assumed that it's guaranteed anyway.  Neither does the ECMA standard.  I assume the compiler/runtime is at liberty to index the array in any order, which may even be different each time. 
    Whereas... for (var i:int=0;i<myArray.length;i++) {......var element:ElementClass=myArray[i]....}
    ....Is guaranteed to traverse the array from first to last.  So I always use this looping statement if the ordering is important.
    MY QUESTION IS.... In ActionScript 3, Can I just assume that the for..each..in will always traverse a dense indexed array from first to last?
    Actually, my specific case at the moment is where another programmer is passing me an array,assembled within a for...each..in loop.   But I need to assume the order of that array.  If this is always going to work in ActionScript3, then no problem.  Although I'll continue to worry about the ECMA standard for my own code, and wont make assumptions about ordering - but I won't force my anal-retentive programming style on the other guy.

    I did a test on it
    case1:
    var arr:Array = new Array();
    arr[0] = 'a';
    arr[1] = 'b';
    arr[2] = 'c';
    arr[3] = 'd';
    for each(var arrEle:string in arr)
         trace(arrEle);
    always output a,b,c,d
    case2:
    var arr:Array = new Array();
    arr[6] = 'd';
    arr[0] = 'a';
    arr[1] = 'b';
    arr[3] = 'c';
    for each(var arrEle:string in arr)
         trace(arrEle);
    always output a,b,d,c
    so I assume array is created in this way: alloc a memory block for array first, when attaching new element(numeric indexd by i) to array, check if i >= length, put new element in the end of array, else put element at i; so in case 2, array is alloced in this way
    array:{'d'} //6>0
    array:{'a', 'd'} //0<1
    array:{'a', 'b', 'd'} //1<2
    array:{'a', 'b', 'd', 'c'} //3>=3
    disclaimer: totally assumption!!!

  • #554 5.4.4 SMTPSEND.DNS.MxLoopback; DNS records for this domain are configured in a loop ##

    Hi,
    This is my first post here. 
    My exchange server of late is facing a peculiar problem. I get the error message that I have posted below when sending mails to any outside domain. However when I restart the server the mails can be resend to the address without any issue. After a certain
    time again the issue pops up upon which I am forced to restart the server again. I am running 2007 Exchange on Windows 2003.
    Generating server: name.mydomain.com
    [email protected]
    #554 5.4.4 SMTPSEND.DNS.MxLoopback; DNS records for this domain are configured in a loop ##
    [email protected]
    #554 5.4.4 SMTPSEND.DNS.MxLoopback; DNS records for this domain are configured in a loop ##
    Original message headers:
    Received: from name.mydomain.com ([1xx.xxx.xxx.xx5]) by MHDMAILS.mouwasat.com
     ([1xx.xxx.xxx.xx5]) with mapi; Wed, 19 Oct 2011 08:56:29 +0300
    From:  <[email protected]>
    To: <[email protected]>
    CC: "Al Alami,Tareq" <[email protected]>
    Date: Wed, 19 Oct 2011 08:56:27 +0300
    Subject: RE:   
    Thread-Topic:   
    Thread-Index: AcyAQ5tu8z9CvBfdT5+1pcGQkk6x0AIuwczAAAGZjeABQyW5sAADeeJQAAETNDA=
    Message-ID: <[email protected]>
    References: <[email protected]com>
     <[email protected]com>
    Accept-Language: en-US
    Content-Language: en-US
    X-MS-Has-Attach: yes
    X-MS-TNEF-Correlator:
    acceptlanguage: en-US
    Content-Type: multipart/related;
                boundary="_004_EEC8FA6B3B286A4E90D709FECDF51AA06C0588CA11namedomain_";
                type="multipart/alternative"
    MIME-Version: 1.0

    On Sun, 23 Oct 2011 15:05:15 +0000, Jobin Jacob wrote:
    >
    >
    >Even af
    >
    >ter removing my domain from the send connector I continue to receive the error. I would like to say I do have a firewall, Cyberoam. However, it was the same configuration till now in the firewall. I did try Mx lookup and found the following.
    >
    >Could there be any other solution to this issue ?
    Sure, but it's necessary to ask a lot of questions since none of us
    know how your organization is set up.
    I see you also have "Use the External DNS Lookup settings on the
    transport server" box checked. How have you configured the "External
    DNS Lookups" on the HT server's property page? Is there any good
    reason why you aren't just using your internal DNS servers? If the
    internal DNS servers are configured to resolve (or forward) queries
    for "external" domains then there's no reason to use that checkbox. In
    most cases checking that box is a mistake.
    http://technet.microsoft.com/en-us/library/aa997166(EXCHG.80).aspx
    The behavior you describe (it works for a while and then fails;
    restarting the server returns it to a working state) sure sounds like
    some sort of DNS problem.
    Rich Matheisen
    MCSE+I, Exchange MVP
    --- Rich Matheisen MCSE+I, Exchange MVP

  • A quick counting loop for a performance test

    Hi all. I'm writing this small performance test using the add method of an arraylist. How would I wrap a for (or while) loop around this code so that it runs 1000 times, averages the total times of all the tests, and then prints the average out? Thanks.
    startTime = System.nanoTime();
    for(int i = 0; i< last.length; i++ ){
    arrayListLast.add(last);
    stopTime = System.nanoTime();
    totalTime = stopTime-startTime;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    What part are you having trouble with?
    Do you not know how to repeat something a certain number of times?
    Do you not know how to compute an average?
    Do you not know how to print something out?

  • How to use db transcation for an OleDb token places in a loop?

    There comes an interesting problem for you, it seems very easy in code:
    using (OleDbConnection con = new OleDbConnection(……))
    OleDbCommand cmd = new OleDbCommand(con);
    OleDbTranscation trans = con.BeginTranscation();
    cmd.CommandText = "update xxx set field1=@field1,field2=@field2 where field3=@field3";
    //Suppose "pCollection" is a collection variable defined before, and this is a stack type.
    Point p = pCollection.Pop();
    while(pCollection.Count!=0)
    cmd.Parameters["@field1"].Value = p.Field1;
    cmd.Parameters["@field2"].Value = p.Field2;
    cmd.Parameters["@field3"].Value = p.Field3;
    cmd.Parameters["@field4"].Value = p.Field4;
    p = pCollection.Pop();
    cmd.ExecuteNonQuery();
    trans.Commit();
    The codes above seems roughly right, however if you run it and you will find that only the last record is updated, because the parameters of SqlCommand are overridden by the latter time of loop, and all the previous loop's parameters are referring to the same
    parameters of SqlCommand, so only the last time the parameters' values take action. And all the transcations are pointing to the last time of updating record.So my question is How
    to make each updating statement takes action within the whole transcation (each updating SQL has different values of parameters)?
    ASP.NET Forum
    Other Discussion Forums
    FreeRice Donate
    Issues to report
    Free Tech Books Search and Download

    The below worked for me:
    using (OleDbConnection con = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
    OleDbCommand cmd = new OleDbCommand();
    cmd.Connection = con;
    con.Open();
    System.Data.OleDb.OleDbTransaction trans = con.BeginTransaction();
    cmd.Transaction = trans;
    cmd.CommandText = "update Category set Category=? where CatId=?";
    int i = 2;
    cmd.Parameters.Add("@field1", OleDbType.VarChar);
    cmd.Parameters.Add("@field2", OleDbType.Integer);
    while (i != 0)
    cmd.Parameters["@field1"].Value = i.ToString();
    cmd.Parameters["@field2"].Value = i;
    i--;
    cmd.ExecuteNonQuery();
    trans.Commit();
    Fouad Roumieh

  • Question for the math lovers!  Using while loop and exponents

    Hi there Java geniuses! ; ) A little question here that has been perplexing me for the past few days. I'm trying to create a class that contains a single static method as follows:
    public static double exp(double a)
    It's supposed to work to calculate an "exp" value much like the Math.exp method of the Math class. Essentially, I need to keep calculating approximations of "exp" until a certain condition is met. This condition is specified in a while loop. Following is what I've written so far. But I can't seem to get the thing to work properly. Any suggestions/ advice would be greatly appreciated! Thanks.
    A class that computes the "exp" for a user-defined
    value.
    public class MyMath
    public static double exp(double x)
    double dbloldGuess;
    double dblnewGuess = 1 + x; // First value for newGuess
    double dblcounter = 1;
    do
    dblcounter++; // increments counter
    dbloldGuess = dblnewGuess;
    dblnewGuess = dbloldGuess + ((x ** dblcounter) / counter);
    while (Math.abs((newGuess - oldGuess) / newGuess) > 1e-15);
    return x;
    }

    ** wasn't an operator in C when I last checked...
    Anyway here's my lousy attempt:public static double exp(double a) {
            double guess = 1;
            int N = 18;
            while (N --> 1) guess = 1 + a/N * guess;
            return guess;
    }When called with 1.0 as argument gives the value equal to the constant Math.E, so is "probably" ok for arguments 0.0 -- 1.0. I wont guarantee anything else because this method is pretty pathological when it comes to loss of precision due to rounding, even if you increase N.

  • Counting Loop I Think: HELP!

    Experience .... Java Beginner: I want to write a few lines where I can count down using a loop. Example: The System.out.println would be like "I have 100 dimes". Using the console (I believe) I would have a User type in a number between 1 and 100. We'll say the User types in 20 and presses Enter. The printout that the User would see would be this:
    I have 100 dimes
    I have 99 dimes
    I have 98 dimes
    I have 97 dimes .... and so on down to "I have 80 dimes".
    I'm really lost as to even know where to start. Can anyone help? THANKS.

    You can do it in both ways.
    1) Getting the input passed as arguments.
    e.g. java DimeTest 20
    public class DimeTest {
        public static void main(String args[]) {
         int num = 0;
         try {
              if(args[0] == null) throw new Exception();
              num = Integer.parseInt(args[0]);
         } catch (Exception e) {
              System.out.println("Usage: java DimeTest [number]");
              System.out.println("e.g. java DimeTest 20");
              System.exit(0);
         int j = 100 - num;
         for(int i = 100; i >= j; i --) {
              System.out.println("I have " + i + " dimes");
    }2) Get the input from the console.
    import java.io.*;
    public class DimeTest2 {
        public static void main(String args[]) throws IOException {
         BufferedReader reader = new BufferedReader(
                             new InputStreamReader(System.in)
         System.out.print("Enter a number:");
         String input = reader.readLine();
         int num = 0;
         try {
              num = Integer.parseInt(input);
         } catch(NumberFormatException e) {
              System.out.println("Please enter a number!");
              System.exit(0);
         int j = 100 - num;
         for(int i = 100; i >= j; i --) {
              System.out.println("I have " + i + " dimes");
    }Good Luck!

Maybe you are looking for

  • Using software instruments that are stored on an external drive.

    I recently bought Logic 9. Doing a custom install, I stored the instrument library on an external disk thinking it would be easy to use the instruments at a later time. Now, however, when I create a software instrument track, I only see the basic exs

  • E65 video transfer from pc

    hello, i dont know how to transfer avi,mpeg,mpg type videos from my pc to my nokia e65... my phone cant read the program file, why is that so? are there any aditional software for my pc or phone that i should download? i hope someone could clear thin

  • Solaris 10 x86 and Adaptec 2400a

    Hello, Are there any plans to add support for Adaptec 2400a (IDE RAID Controller) to Solaris 10 x86? Thank you, Jakob

  • Can't view published changes

    Here's the situation: I've got Contribute on my wife's machine and Dreamweaver 8 on mine. Using Contribute on her computer, I edit a page from our website and publish it. (She's the Contribute Admin .) The change is immediately visible on my machine,

  • Major Lion Flaw: Uncontrollable Logging and Disk Usage

    Okay, after reading a few users' problems I double checked myself just in case. I opened up the console app, and there were hundreds, if not thousands of logs just in the past 2 hours. And when I say 'get info' on Macintosh HD the used disk space is