NEXT_RECORD problem

Hi All,
I am using Forms6.0
I have two database blocks A & B. For each record in A, i may insert a record in B depending on the user entering values. Problem is that even if user enters values for two records, only one is inserted in table of block B. The code is as follows:
PROCEDURE update_B IS
BEGIN
delete_block('B') ;
GO_BLOCK('A') ;
FIRST_RECORD ;
LOOP
GO_BLOCK('A') ;
IF :system.record_status = 'NEW' THEN
EXIT ;
END IF ;
IF (:A.amt > 0.00) THEN
preparing record for table of block B;
GO_BLOCK('B') ;
NEXT_RECORD ;
********problem**********
END IF ;
GO_BLOCK('A') ;
IF :system.last_record = 'TRUE' THEN
EXIT ;
ELSE
NEXT_RECORD ;
END IF ;
END LOOP ;
END;
Problem occurs at indicated point.I gave messages to find that at this point even for block A i reach at next record which is last record and so, it does not get updated.
Can anyone help?

Hi Gerd,
The complete code is as under...And, CREATE_RECORD behaved in the same way as NEXT_RECORD. Thanks...
PROCEDURE update_grrel IS
BEGIN
delete_block('grrel_blk') ;
GO_BLOCK('gr_blk') ;
FIRST_RECORD ;
bmessage('first record before loop...gr adj amt= '||:gr_blk.v_ebgr_adj_amt);
LOOP
GO_BLOCK('gr_blk') ;
bmessage('after loop start...gr adj amt= '||:gr_blk.v_ebgr_adj_amt);
IF :system.record_status = 'NEW' THEN
EXIT ;
END IF ;
IF (:gr_blk.v_ebgr_adj_amt > 0.00) THEN
     bmessage('preparing record...gr adj amt= '||:gr_blk.v_ebgr_adj_amt);
     :grrel_blk.ebgrrel_prod_code:=:gr_blk.ebgr_prod_code ;
:grrel_blk.ebgrrel_ref_no:=:gr_blk.ebgr_ref_no ;
:grrel_blk.ebgrrel_no:=:gr_blk.ebgr_no ;
:grrel_blk.ebgrrel_serial_no:=:ctrl_blk.v_serial_no ;
:grrel_blk.ebgrrel_shiping_bill_no:=:gr_blk.ebgr_shiping_bill_no ;
:grrel_blk.ebgrrel_realised_amt:= :gr_blk.v_ebgr_adj_amt ;
:grrel_blk.ebgrrel_realised_dt:=:hdr_blk.proc_dt ;
:grrel_blk.ebgrrel_realised_status
:= :gr_blk.v_ebgrrel_realised_status;
if (:ctrl_blk.mode='S') then
:gr_blk.realisation_flg:= :v_ebgrrel_realised_status;
:gr_blk.ebgr_total_realised_amt :=
NVL(:gr_blk.ebgr_total_realised_amt,0) +
NVL(:gr_blk.v_ebgr_adj_amt,0);
end if;
bmessage('aftr preparing record...gr adj amt= '||:gr_blk.v_ebgr_adj_amt);
GO_BLOCK('grrel_blk') ;
--NEXT_RECORD ;
CREATE_RECORD ;
bmessage('bfore end if...gr adj amt= '||:gr_blk.v_ebgr_adj_amt);
END IF ;
GO_BLOCK('gr_blk') ;
bmessage('after end if...gr adj amt= '||:gr_blk.v_ebgr_adj_amt);
bmessage('system.last_record= '||:system.last_record);
IF :system.last_record = 'TRUE' THEN
EXIT ;
ELSE
NEXT_RECORD ;
END IF ;
bmessage('before end loop...gr adj amt= '||:gr_blk.v_ebgr_adj_amt);
END LOOP ;
END;
*****************************************

Similar Messages

  • Problem Multiple record navigation in oracle forms

    I retrieve multiple records using cursor fetch command in the select query i have given condition to retrieve details of employee no.
    For example if we are giving an input as empno:100 then it retrieves two records of same emp no(100).It displays 2/3 records in the task bar when i navigate using push buttons it displays an empty record in the interface provided.(ie 3/3 records).How to avoid third unknown record displaying in the interface.

    most likely the problem is during the population of the block using the query.
    i assume that you are creating one additional record after the last record from your query..
    so this must be either with the CREATE_RECORD or NEXT_RECORD problem in the loop.so you should check in the loop first if the record exists, then do CREATE_RECORD or NEXT_RECORD.

  • Problem on forms for serial number generation with last record next_record.

    Hi Experts,
    currently i'm facing one problem like :
    i'm populating one receipt detail in Multi block , like when user key in one receipt number that time record should go in first record ,and if they key in second receipt number then record should go in second record . mean to say every time record go in last record ..but the problem is i want to generate Serial no correspondence to every last record ..
    here is my approch :
    cursor c1 is
    select * from table
    where cname =:blk_name.clm_name.
    Last record;
    next_record;
    for v1 in c1 loop
    processed record;
    next_record;
    end loop;
    last_record;
    go_block(___);
    first_record;
    :sno := system.cursor_record ;
    next_reocrd;
    end loop;
    first_record;
    And in block level i'm writing code for Serial number generation when user key in manual entry for receipt detail:
    :blk_name.coulumn_name := :system. cursor_record;
    so in this approach their is no problem it is working properly but the problem is that
    when user fetch one receipt automatically and then after he want to enter next record manually and he decided to go in detail block ,
    and once he reached in detail block that time block level trigger i firing .ans serial number 2 generated and then suddenly he came to know no i want to fetch next record automatically mean to say now user going again master block and fetching next receipt detail ,
    but the problem is when user leaving seccond sr no and going in master block and population next receipt detail that time cursor going on 3 record
    but logically have to replace the second Serial no and generate the again serial number 2 record population .mean to say its not refreshing last_record..
    so i'm appreciating is anyone if came accoross this type of issue please corrrect my code and send updated code ..plsssssssssssssssssssssssssssssss
    Thanks
    Abhishek
    [email protected]

    hi
    I put this below code on when_new_record_instance on block level..
    :blk_name.column_name :=system.cursor_record;
    so can you please help me.....
    Thanks
    Abhishek

  • Problem in UPDATE statement In Multiple Record Block

    Hi Friends,
    I have problem in update Statement for updating the record in multiple record data Block.
    I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
    I am inserting the fields like category,and post_no for partiular job in single data block
    Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
    There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
    then its updating all the record.
    my code is Bellow,
    IF v_count 0 THEN
    LOOP
    IF :SYSTEM.last_record 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
    VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
    :POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    next_record;
    ELSIF :SYSTEM.last_record = 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
    VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
    :POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    EXIT;
    END IF;
    END LOOP;
    SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
    v_button_no := SHOW_ALERT('user_alert');
    FORMS_DDL('COMMIT');
    CLEAR_FORM(no_validate);
    Please Guide me
    Thanks in advence

    As you do a loop over all the records in the block, of course every record is updated.
    Also, what you do is not the way is intended to be used. In general, you base a block on a table,then there is no need at all for writing INSERT's or UPDATE's. Forms also know's then, which records to be updated and which not.

  • Problem In Update Statement In Multiple Record Data Block

    Hi Friends,
    I have problem in update Statement for updating the record in multiple record data Block.
    I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
    I am inserting the fields like category,and post_no for partiular job in single data block
    Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
    There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
    then its updating all the record.
    my code is Bellow,
    IF v_count <> 0 THEN
    LOOP
    IF :SYSTEM.last_record <> 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
    VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
    :POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    next_record;
    ELSIF :SYSTEM.last_record = 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
         VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
              :POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    EXIT;
    END IF;
    END LOOP;
    SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
    v_button_no := SHOW_ALERT('user_alert');
    FORMS_DDL('COMMIT');
    CLEAR_FORM(no_validate);
    Please Guide me
    Thanks in advence

    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;These update statements are without where clause, so it will update all records.
    If it is specific to oracle forms then u may get better help at Forms section.

  • Problem: trying to update all detail rows on pre-commit (MASTER DETAIL FORM

    Hi:
    I got a MASTER DETAIL form... and I need to update every detail row of this form (if the master was updated) before commiting the changes. the problem is that i cannot do that for instance in PRE-COMMIT or ON-COMMIT... it's an "illegal operation". I achieved part of it by coding KEY-COMMIT... but that did not solve the all problem. first take a look of the kind of code i want execute before commiting.
    form trigger key-commit code is is somehow like this:
    DECLARE
    tot_line NUMBER (3);
    line NUMBER (3);
    begin
    IF NAME_IN ('system.form_status') = 'CHANGED'
    THEN
    GO_BLOCK ('DETAIL');
    LAST_RECORD;
    tot_line := GET_BLOCK_PROPERTY ('DETAIL', current_record);
    FIRST_RECORD;
    line:= 1;
    LOOP
    :detail.quant := :detail.quant + 1;
    EXIT WHEN line= tot_line;
    next_record;
    line:= line+ 1;
    END LOOP;
    FIRST_RECORD;
    GO_BLOCK ('MASTER');
    END IF;
    COMMIT;
    end;
    The problem is for instance when the users close form in the "X" button (right top, near minimize form) ... If they do that Forms ask "Do you want to save changes?" ... and with this i do not execute the update of the detail rows...
    But there are other situations when this happens... for instance if EXECUTE_QUERY when i change a record...
    Anyone help?
    Joao Oliveira

    Use PRE-UPDATE trigger (Master block).
    begin
    update <detail_table>
    set quant + 1
    where <detail_table>.<relaition_column1> = :<Master_block>.<relaition_item1>
    and <detail_table>.<relaition_columnN> = :<Master_block>.<relaition_itemN>
    and <detail_block_WHERE>;
    EXCEPTION WHEN OTHERS THEN NULL;
    end;

  • Problem in displaying records in multi record block

    Hi all,
    I have a problem in displaying records in a multi record block in a form.
    I have 1 control block and 1 data block(multi-record block).
    Control block has one item CUSTOMER-ID. Data block has many other items related to customer.
    when a value is entered in customer-id text item, all the relavant details should be displayed in the data block.
    but, the records are overlapping in the same line in the data block, actually they have to be displayed one record per one line.
    The code is,
    IF :CUST_BLOCK.CUST_ID IS NOT NULL THEN
    GO_BLOCK('XBSI_CONTRACT_PRICE_FACTORS');
    FOR C1 IN C
    LOOP
    :XBSI_CONTRACT_PRICE_FACTORS.CUST_ID:=c1.site_use_id;
    :XBSI_CONTRACT_PRICE_FACTORS.CAT_ID:=c1.ipc_category_id;
    :XBSI_CONTRACT_PRICE_FACTORS.MFG_ID:=c1.mfg_category_id;
    :XBSI_CONTRACT_PRICE_FACTORS.INVENTORY_ITEM_ID:=c1.inventory_item_id;
    :XBSI_CONTRACT_PRICE_FACTORS.PRICE_BASIS:=c1.price_basis;
    :XBSI_CONTRACT_PRICE_FACTORS.PRICE_FACTOR:=c1.price_factor;
    END LOOP;
    Please help me out..
    Thanks in advance!
    Suman

    Hi Suman
    IF :CUST_BLOCK.CUST_ID IS NOT NULL THEN
    GO_BLOCK('XBSI_CONTRACT_PRICE_FACTORS');
    first_record;
    FOR C1 IN C
    LOOP
    :XBSI_CONTRACT_PRICE_FACTORS.CUST_ID:=c1.site_use_id;
    :XBSI_CONTRACT_PRICE_FACTORS.CAT_ID:=c1.ipc_category_id;
    :XBSI_CONTRACT_PRICE_FACTORS.MFG_ID:=c1.mfg_category_id;
    :XBSI_CONTRACT_PRICE_FACTORS.INVENTORY_ITEM_ID:=c1.inventory_item_id;
    :XBSI_CONTRACT_PRICE_FACTORS.PRICE_BASIS:=c1.price_basis;
    :XBSI_CONTRACT_PRICE_FACTORS.PRICE_FACTOR:=c1.price_factor;
    next_record;
    END LOOP;
    Try this. you are trying to show all the records in same line. so its overlapping.
    Thankyou
    [email protected]

  • Problem while transfering data from form to excel

    Hi all.
    I have a little problem. I have a procedure that fires on when-button-pressed trigger that goes to current block and download the data into an excel file.
    The block has 2200 records.
    The problem is that if I make the application visible all is ok; if I make the application not visible it remains "append" and nothing happens.
    I'm on developer suite 10g.
    Here is the code:
    PROCEDURE pr_Forms_to_Excel(p_block_name IN VARCHAR2 DEFAULT NAME_IN('system.current_block')) IS
    -- Declare the OLE objects
    application OLE2.OBJ_TYPE;
    workbooks OLE2.OBJ_TYPE;
    workbook OLE2.OBJ_TYPE;
    worksheets OLE2.OBJ_TYPE;
    worksheet OLE2.OBJ_TYPE;
    cell OLE2.OBJ_TYPE;
    range OLE2.OBJ_TYPE;
    range_col OLE2.OBJ_TYPE;
    -- Declare handles to OLE argument lists
    args OLE2.LIST_TYPE;
    -- Declare form and block items
    form_name VARCHAR2(100);
    f_block VARCHAR2(100);
    l_block VARCHAR2(100);
    f_item VARCHAR2(100);
    l_item VARCHAR2(100);
    cur_block VARCHAR2(100) := NAME_IN('system.current_block');
    cur_item VARCHAR2(100) := NAME_IN('system.current_item');
    cur_record VARCHAR2(100) := NAME_IN('system.cursor_record');
    item_name VARCHAR2(100);
    baslik VARCHAR2(100);
    row_n NUMBER;
    col_n NUMBER;
    filename VARCHAR2(100);
    BEGIN
    -- Start Excel
    application:=OLE2.CREATE_OBJ('Excel.Application');
    OLE2.SET_PROPERTY(application, 'Visible', 'TRUE');
    -- Return object handle to the Workbooks collection
    workbooks:=OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
    -- Add a new Workbook object to the Workbooks collection
    workbook:=OLE2.GET_OBJ_PROPERTY(workbooks,'Add');
    -- Return object handle to the Worksheets collection for the Workbook
    worksheets:=OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
    -- Get the first Worksheet in the Worksheets collection
    -- worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Add');
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, 1);
    worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
    OLE2.DESTROY_ARGLIST(args);
    -- Return object handle to cell A1 on the new Worksheet
    go_block(p_block_name);
    baslik := get_block_property(p_block_name,FIRST_ITEM);
    f_item := p_block_name||'.'||get_block_property(p_block_name,FIRST_ITEM);
    l_item := p_block_name||'.'||get_block_property(p_block_name,LAST_ITEM);
    first_record;
    LOOP
    item_name := f_item;
    row_n := NAME_IN('SYSTEM.CURSOR_RECORD');
    col_n := 1;
    LOOP
    IF get_item_property(item_name,ITEM_TYPE)<>'BUTTON' AND
    get_item_property(item_name,VISIBLE)='TRUE'
    THEN
    -- Set first row with the item names
    IF row_n=1 THEN
    baslik:=NVL(get_item_property(item_name,PROMPT_TEXT),baslik);
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, row_n);
    OLE2.ADD_ARG(args, col_n);
    cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
    OLE2.DESTROY_ARGLIST(args);
    OLE2.SET_PROPERTY(cell, 'Value', baslik);
    OLE2.RELEASE_OBJ(cell);
    END IF;
    -- Set other rows with the item values
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, row_n+1);
    OLE2.ADD_ARG(args, col_n);
    cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
    OLE2.DESTROY_ARGLIST(args);
    IF get_item_property(item_name,DATATYPE)<>'NUMBER' THEN
    OLE2.SET_PROPERTY(cell, 'NumberFormat', '@');
    END IF;
    OLE2.SET_PROPERTY(cell, 'Value', name_in(item_name));
    OLE2.RELEASE_OBJ(cell);
    END IF;
    IF item_name = l_item THEN
    exit;
    END IF;
    baslik := get_item_property(item_name,NEXTITEM);
    item_name := p_block_name||'.'||get_item_property(item_name,NEXTITEM);
    col_n := col_n + 1;
    END LOOP;
    EXIT WHEN NAME_IN('system.last_record') = 'TRUE';
    NEXT_RECORD;
    END LOOP;
    -- Autofit columns
    range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
    range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
    OLE2.INVOKE( range_col,'AutoFit' );
    OLE2.RELEASE_OBJ( range );
    OLE2.RELEASE_OBJ( range_col );
    -- Get filename and path
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG( args, p_block_name );
    OLE2.ADD_ARG( args,'Excel Workbooks (*.xls, *.xls');
    filename := OLE2.INVOKE_CHAR( application,'GetSaveAsFilename',args );
    OLE2.DESTROY_ARGLIST( args );
    -- Save as worksheet
    IF NVL(filename,'0')<>'0' THEN
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG( args,filename );
    OLE2.INVOKE( worksheet,'SaveAs',args );
    OLE2.DESTROY_ARGLIST( args );
    END IF;
    -- Close workbook
    OLE2.INVOKE( workbook ,'Close');
    -- Release the OLE objects
    OLE2.RELEASE_OBJ(worksheet);
    OLE2.RELEASE_OBJ(worksheets);
    OLE2.RELEASE_OBJ(workbook);
    OLE2.RELEASE_OBJ(workbooks);
    OLE2.INVOKE(application, 'Quit');
    OLE2.RELEASE_OBJ(application);
    -- Focus to the original location
    go_block(cur_block);
    go_record(cur_record);
    go_item(cur_block||'.'||cur_item);
    END;
    Is there anyone that can help me????
    Thanks,
    Fabrizio

    Hi all.
    I have a little problem. I have a procedure that fires on when-button-pressed trigger that goes to current block and download the data into an excel file.
    The block has 2200 records.
    The problem is that if I make the application visible all is ok; if I make the application not visible it remains "append" and nothing happens.
    I'm on developer suite 10g.
    Here is the code:
    PROCEDURE pr_Forms_to_Excel(p_block_name IN VARCHAR2 DEFAULT NAME_IN('system.current_block')) IS
    -- Declare the OLE objects
    application OLE2.OBJ_TYPE;
    workbooks OLE2.OBJ_TYPE;
    workbook OLE2.OBJ_TYPE;
    worksheets OLE2.OBJ_TYPE;
    worksheet OLE2.OBJ_TYPE;
    cell OLE2.OBJ_TYPE;
    range OLE2.OBJ_TYPE;
    range_col OLE2.OBJ_TYPE;
    -- Declare handles to OLE argument lists
    args OLE2.LIST_TYPE;
    -- Declare form and block items
    form_name VARCHAR2(100);
    f_block VARCHAR2(100);
    l_block VARCHAR2(100);
    f_item VARCHAR2(100);
    l_item VARCHAR2(100);
    cur_block VARCHAR2(100) := NAME_IN('system.current_block');
    cur_item VARCHAR2(100) := NAME_IN('system.current_item');
    cur_record VARCHAR2(100) := NAME_IN('system.cursor_record');
    item_name VARCHAR2(100);
    baslik VARCHAR2(100);
    row_n NUMBER;
    col_n NUMBER;
    filename VARCHAR2(100);
    BEGIN
    -- Start Excel
    application:=OLE2.CREATE_OBJ('Excel.Application');
    OLE2.SET_PROPERTY(application, 'Visible', 'TRUE');
    -- Return object handle to the Workbooks collection
    workbooks:=OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
    -- Add a new Workbook object to the Workbooks collection
    workbook:=OLE2.GET_OBJ_PROPERTY(workbooks,'Add');
    -- Return object handle to the Worksheets collection for the Workbook
    worksheets:=OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
    -- Get the first Worksheet in the Worksheets collection
    -- worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Add');
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, 1);
    worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
    OLE2.DESTROY_ARGLIST(args);
    -- Return object handle to cell A1 on the new Worksheet
    go_block(p_block_name);
    baslik := get_block_property(p_block_name,FIRST_ITEM);
    f_item := p_block_name||'.'||get_block_property(p_block_name,FIRST_ITEM);
    l_item := p_block_name||'.'||get_block_property(p_block_name,LAST_ITEM);
    first_record;
    LOOP
    item_name := f_item;
    row_n := NAME_IN('SYSTEM.CURSOR_RECORD');
    col_n := 1;
    LOOP
    IF get_item_property(item_name,ITEM_TYPE)<>'BUTTON' AND
    get_item_property(item_name,VISIBLE)='TRUE'
    THEN
    -- Set first row with the item names
    IF row_n=1 THEN
    baslik:=NVL(get_item_property(item_name,PROMPT_TEXT),baslik);
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, row_n);
    OLE2.ADD_ARG(args, col_n);
    cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
    OLE2.DESTROY_ARGLIST(args);
    OLE2.SET_PROPERTY(cell, 'Value', baslik);
    OLE2.RELEASE_OBJ(cell);
    END IF;
    -- Set other rows with the item values
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, row_n+1);
    OLE2.ADD_ARG(args, col_n);
    cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
    OLE2.DESTROY_ARGLIST(args);
    IF get_item_property(item_name,DATATYPE)<>'NUMBER' THEN
    OLE2.SET_PROPERTY(cell, 'NumberFormat', '@');
    END IF;
    OLE2.SET_PROPERTY(cell, 'Value', name_in(item_name));
    OLE2.RELEASE_OBJ(cell);
    END IF;
    IF item_name = l_item THEN
    exit;
    END IF;
    baslik := get_item_property(item_name,NEXTITEM);
    item_name := p_block_name||'.'||get_item_property(item_name,NEXTITEM);
    col_n := col_n + 1;
    END LOOP;
    EXIT WHEN NAME_IN('system.last_record') = 'TRUE';
    NEXT_RECORD;
    END LOOP;
    -- Autofit columns
    range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
    range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
    OLE2.INVOKE( range_col,'AutoFit' );
    OLE2.RELEASE_OBJ( range );
    OLE2.RELEASE_OBJ( range_col );
    -- Get filename and path
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG( args, p_block_name );
    OLE2.ADD_ARG( args,'Excel Workbooks (*.xls, *.xls');
    filename := OLE2.INVOKE_CHAR( application,'GetSaveAsFilename',args );
    OLE2.DESTROY_ARGLIST( args );
    -- Save as worksheet
    IF NVL(filename,'0')<>'0' THEN
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG( args,filename );
    OLE2.INVOKE( worksheet,'SaveAs',args );
    OLE2.DESTROY_ARGLIST( args );
    END IF;
    -- Close workbook
    OLE2.INVOKE( workbook ,'Close');
    -- Release the OLE objects
    OLE2.RELEASE_OBJ(worksheet);
    OLE2.RELEASE_OBJ(worksheets);
    OLE2.RELEASE_OBJ(workbook);
    OLE2.RELEASE_OBJ(workbooks);
    OLE2.INVOKE(application, 'Quit');
    OLE2.RELEASE_OBJ(application);
    -- Focus to the original location
    go_block(cur_block);
    go_record(cur_record);
    go_item(cur_block||'.'||cur_item);
    END;
    Is there anyone that can help me????
    Thanks,
    Fabrizio

  • NEXT,PREV,FIRST,LAST PROBLEM

    hi to all
    i'm using form6i and run in c\s
    i have 7 records, (1,2,3,4,5,6,7), the problem is when i click next_Record button it will go the the last_record which is 7. when i click previous it will go to the first record which is 1. when i click last_record it will go to last. when i click first it will to to first..
    my trigger is when button pressed for 4 buttons..
    execute_query
    LAST_RECORD
    execute_query
    First_Record
    execute_query
    Previous_RECORD
    execute_query
    Next_RECORD
    is my code wrong?

    my trigger is when button pressed for 4 buttons..
    execute_query
    LAST_RECORD
    execute_query
    First_Record
    execute_query
    Previous_RECORD
    execute_query
    Next_RECORD
    is my code wrong?execute query....?
    are you only navigating between the records already queried or querying the records at each button click.... clarify???

  • Execute query and Message Box Problem!

    Hi,
    I have a procedure to built undo function :
    declare
    ls_row varchar2(55);
    ls_item varchar2(55);
    begin
    go_block(:parameter.l_current_block);
    ls_row := :m_form.rowid;
    execute_query;
    if ls_row is null then return; end if;
    loop
    exit when :m_form.rowid = ls_row;
    exit when :system.last_record = 'TRUE';
    next_record;
    end loop;
    end;
    This procedure working fine.
    When I have edit some data and want to undo, then I pressed undo button. It's always display the message box "Do you want to save change you have made?".
    I don't know how to make this message box can't display and being the execute_query work directed.
    It's urgent, please help!
    Thanks,
    Leny

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by lenyhu:
    Hi,
    I have a problem again........
    If the item have a when-validate-item trigger. When I run undo function, how can I do to skip this validation and just do the undo function?
    Leny <HR></BLOCKQUOTE>
    set_item_property ( item_id, item_is_valid, property_true );
    undo_function
    set_item_property ( item_id, item_is_valid, property_false );
    hope this helps.

  • Problem with multiline text item return on query

    Hi there, I am a beginner in ORACLE, here when i write a query i engaged a weird problem,
    LOOP
    FETCH CSR_ODR2 INTO :ORDER_RECORD.OREDER_RECORD_NO,:ORDER_RECORD.BILL_NO,:ORDER_RECORD.ACTUALO_WEIGHT,:ORDER_RECORD.OPERATION,:ORDER_RECORD.PLACE,:ORDER_RECORD.TRANSACTION_DATE,:ORDER_RECORD.ORDER_NO;
    EXIT WHEN CSR_ODR2%NOTFOUND;
    END LOOP;
    this is the cursor version, I also tried SELECT statement, but have trouble about return more than 1 row.
    :Order_Record is a detailed-form with multiline text items,while execute this cursor, it always rewrite the 1st line and wont go to 2nd line, I wanna get some help about how to display different records in different line in a text item.
    btw, i tried next_record,next_item,next_field, but none of them works, the query is based on the record i filled on the master form, and show related record in detailed-form
    Kyle
    Edited by: user12234866 on 13-Jun-2010 00:32

    DECLARE
    CURSOR CSR_ORDER IS
    SELECT T.ORDER_DATE,T.WEIGHT,T.CUSTOMER,T.DRIVER_NO,T.INVOICE_NO,T.LICENSE_NR_TRUCK,T.PRODUCT,T.PRICE_PER_TON,T.TRAILER_NO
    FROM TRANSPORT_ORDER T
    WHERE T.ORDER_NO=:TRANSPORT_ORDER.ORDER_NO;
    BEGIN
    OPEN CSR_ORDER;
    LOOP
    FETCH CSR_ORDER INTO :TRANSPORT_ORDER.ORDER_DATE,:TRANSPORT_ORDER.WEIGHT,:TRANSPORT_ORDER.CUSTOMER,:TRANSPORT_ORDER.DRIVER_NO,:TRANSPORT_ORDER.INVOICE_NO,:TRANSPORT_ORDER.LICENSE_NR_TRUCK,:TRANSPORT_ORDER.PRODUCT,:TRANSPORT_ORDER.PRICE_PER_TON,:TRANSPORT_ORDER.TRAILER_NO;
    EXIT WHEN CSR_ORDER%NOTFOUND;
    END LOOP;
    END;
    DECLARE
    CURSOR CSR_ODR2 IS
    SELECT O.OREDER_RECORD_NO,O.BILL_NO,O.ACTUALO_WEIGHT,O.OPERATION,O.PLACE,O.TRANSACTION_DATE,O.ORDER_NO
    FROM ORDER_RECORD O
    WHERE O.ORDER_NO=:TRANSPORT_ORDER.ORDER_NO
    ORDER BY OREDER_RECORD_NO asc;
    BEGIN
    OPEN CSR_ODR2;
    GO_BLOCK(':ORDER_RECORD');
    LOOP
    FETCH CSR_ODR2 INTO :ORDER_RECORD.OREDER_RECORD_NO,:ORDER_RECORD.BILL_NO,:ORDER_RECORD.ACTUALO_WEIGHT,:ORDER_RECORD.OPERATION,:ORDER_RECORD.PLACE,:ORDER_RECORD.TRANSACTION_DATE,:ORDER_RECORD.ORDER_NO;
    EXIT WHEN CSR_ODR2%NOTFOUND;
    END LOOP;
    END;
    thats the stuff i wrote here to execute

  • Problem in Message Displaying

    declare
         cursor c1 is SELECT  b.SEQ_NO, a.CUST_NO, c.NAME, b.CHQ_NO, b.AMOUNT, b.RENT_NO, a.CT_NO
    FROM PDC_SETUP a, PDC_DTL b, CU_CUSTOMER c
    WHERE ((b.REC_NO=a.REC_NO)
    AND (a.CUST_NO=c.CUST_NO))
      and chq_dt=:dated
      and seq_no not in (select seq_no from pdc_dpst_dtl d  where d.seq_no=b.seq_no)
    order by a.ct_no;
    begin
         for a in c1 loop
              :seq_no:=a.seq_no;
              :ct_no:=a.ct_no;
              :accode:=:gl_code;
           :rent_no:=a.rent_no;
           :client:=a.name;
              :DEPOSITE_DATE:=:dated;
              :amount:=a.amount;
              :chq_no:=a.chq_no;
              :status:='Y';
              next_record;
         end loop;
         first_record;
         end;
    exception
         when
         no_data_found then
         message('No Record Found');
    message('No Record Found');My problem is that....the message is not displaying..tell me from where i am mistaken.
    Regards
    Danish Hayder

    In your Begin/End block you are assigning values based on the values retrieved from the cursor.
    The for loop inside the begin/end will work only for the values retrieved from the cursor.
    Thus there will not be any scenario where you will get NO_DATA FOUND.
    Please mark the answer if it helps

  • Next_record and last_record issue

    Dear all :
    After I run the next_record procedure for 11 times ( only 10 records in the table ) ,there is no data in the 11th record .
    Could I add some condition to determine the last record
    and always stay at the last record with data whenever I run the next_record procedure over 11 times ?
    Thank you

    Hi,
    This code will solve your problem.
    DECLARE
    V_NO NUMBER := 0;
    BEGIN
    FIRST_RECORD;
    WHILE V_NO = 0 LOOP
         IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
         V_NO := 1;
    EXIT;
         ELSE
         NULL;
         END IF;                         NEXT_RECORD;
         END LOOP;
    END;
    Cheers !
    Adinath Kamode

  • Problem in data fetching

    Hi frnds ,
    When i am testing my workflow i am able to see the values properly . I am havign a activity which is caling a standard template via method which is having some parametres for fetchign the email . so the email is also going to the proper person
    But when i am executing my workflow through the program using event fm then i am not able to see any data displayed . the workflow is triggering if i use a the email as workflow initiator . But there is some problem in data fetching when i go through the program .
    Plz help
    Thanks
    Rohit

    Change this to
    declare
    begin
         go_block('fwqrecview');
    first_record;
    loop
    if :fwqrecview.chk is null then
    clear_record;
    else
    Next_Record;
    Exit When :System.Last_Record = 'TRUE';
    end if;
    end loop;
    end;
    ------------------- End Step 1---------------
    -- fetching records from block 1 -----
    ---- Step 2
         DECLARE
              CURSOR Cur_rv IS
         --     select voucherno.nextval GlVoucher,t.* from
              select inv_no,to_char(r_date,'YYYY') Year, to_char(r_date,'MM') Period,'SRV' Vtype,
              r_date Vdate, narration
              from receipt
              where inv_no = :fwqrecview.inv_no ;
              --) t ;
    BEGIN
              OPEN Cur_rv;
              GO_BLOCK('tempVmaster');
    first_record;
              LOOPi
                   FETCH Cur_Rv INTO :VM_NO,:VM_YEAR,:VM_PERIOD,:VM_VOUCHER_TYPE,:VM_DATE,:VM_NARRATION ;
                   message ('Inv...'||:vm_no);
                   EXIT WHEN Cur_Rv%NOTFOUND;
                   NEXT_RECORD;
              END LOOP;
              CLOSE Cur_Rv;
              FIRST_RECORD;
    END;
    ---- End Step 2 -------

  • Forms 6i problem in procedures for make update

    dear sirs,
    i had procedure to make update for tree of accounts, but make update to some levels and other level no, and here is the procedure if inside it any problem pls advice me
    CREATE OR REPLACE PROCEDURE updup_acc_trbal2(
    wyear IN NUMBER ,
    wperiod IN NUMBER ,
    wcost_center IN VARCHAR2 ,
    wacc_no IN VARCHAR2,
    wcurr_code IN VARCHAR2 ,
    lval_db IN NUMBER ,
    lval_cr IN NUMBER ,
    val_db IN NUMBER ,
    val_cr IN NUMBER )
    IS
    BEGIN
    declare
    ------------acc----
    acc_a varchar2(15);
    acc_b varchar2(15);
    cost_a varchar2(15);
    cost_m varchar2(15);
    cursor c0 is
    select a1,a2,a3,a4,a5,a6,a7,a8 from acc_master_file
    where acc_no = wacc_no;
    type acc_arr0 is table of varchar2(15)
    index by binary_integer;
    arr_acc acc_arr0;
    i binary_integer:= 0;
    -------------cost----
    cursor c is
    select c1,c2,c3,c4,c5,c6,c7,c8,c9 from cost_tables
    where cost_center = wcost_center;
    type acc_arr is table of varchar2(15)
    index by binary_integer;
    cost_acc acc_arr;
    i_cost binary_integer:= 0;
    begin
    open c0;
    fetch c0 into arr_acc(1),arr_acc(2),arr_acc(3),
    arr_acc(4),arr_acc(5),arr_acc(6),
    arr_acc(7),arr_acc(8);
    close c0;
    open c;
    fetch c into cost_acc(1),cost_acc(2),cost_acc(3),
    cost_acc(4),cost_acc(5),cost_acc(6),
    cost_acc(7),cost_acc(8),cost_acc(9);
    close c;
    i := 0;
    i_cost := 0;
    loop
    i_cost := i_cost + 1;
    exit when (i_cost > 9);
    loop
    i := i + 1;
    exit when (i > 8);
    acc_a := arr_acc(i);
    cost_a := wcost_center;--cost_acc(i_cost);
    cost_m := cost_acc(i_cost);
    acc_b := wacc_no;
    if cost_m is not null then
    if acc_a is not null then
    if acc_a <> wacc_no then --v then
    if cost_m <> wcost_center then
    update cost_bal
    set tr_deb = nvl(tr_deb,0) + nvl(lval_db,0),
    tr_cr = nvl(tr_cr,0) + nvl(lval_cr,0),
    c_tr_deb = nvl(c_tr_deb,0)+ nvl(val_db,0),
    c_tr_cr = nvl(c_tr_cr,0) + nvl(val_cr,0)
    where year = wyear
    and period_no = wperiod
    and acc_no = acc_a
    and cost_center = cost_m wcost_centercost_a
    and ((curr_code = wcurr_code
    and wcurr_code is not null)
    or(curr_code is null
    and wcurr_code is null));
    if sql%notfound then
    insert into cost_bal
    (year,period_no,cost_center,acc_no,curr_code,
    op_deb,op_cr,c_op_deb,c_op_cr,
    tr_deb,tr_cr,c_tr_deb,c_tr_cr,
    created_by,created_date,
    changed_by,changed_date)
    values
    (wyear,wperiod,cost_m,acc_a,wcurr_code,
    0,0,0,0,
    nvl(lval_db,0),nvl(lval_cr,0),nvl(val_db,0),
    nvl(val_cr,0),user,sysdate,null,null);
    end if;
    end if;
    end if;
    end if;
    end if;
    end loop;
    end loop;
    end;
    END updup_acc_trbal2;

    Please use below one:
    BEGIN
    if filename is null then
    filename := 'E:\STUDY\experiences\forms\tour\countries.txt';
    end if;
    MYFILE := TEXT_IO.FOPEN(FILENAME, 'R');
    SYNCHRONIZE;
    LOOP
    TEXT_IO.GET_LINE(MYFILE, LINEBUF);
    temp := temp + (length (LINEBUF));
    go_block('COUNTRIES');
    last_record; ---------------------------------
    next_record; ----------------------------------
    :country_code := LINEBUF || CHR(10);
    create_record;
    END LOOP;
    EXCEPTION
    when no_file then
    message('you can not access here. ' );
    END;

Maybe you are looking for

  • Is there a way to change the default sound for alarms?

    That is, when I set a new event, I have it set to have the alarm activate one day before the actual event (thanks to MadisonP for answering that). I'd like to change the default alarm from Basso to something a little more pleasant. Is it possible to

  • Applet not loading from JAR?

    Well, I've been having a bit of a problem with embedding my applet into a webpage. My applet tag looks like this: <applet archive="poke.jar" code="a.class" width=550 height=600> <param name=cachelistsrcdir value="http://io9labs.com/poke/cache"> </app

  • Apple Mobile Device Support is not installed as a Window Service

    How can I install the Apple Mobile Device Service as a Windows Service? I have an external hard drive where I was able to extract the Windows Installer Package from C:\ProgramFiles\CommonFiles\Apple, but I don't now what to do with it, or if it would

  • Incorrect bookmark is highlighted

    This post relates to Acrobat 9.1.2. Pro on Windows XP sp3. When jumping to a page by clicking a Link on another page, the correct page is displayed in the Document Pane, but somtimes the incorrect (next-following) Bookmark is highlighted in the Bookm

  • Reg Tcode SWI1_cond.

    Hi,     User is unable to forward a work item using transaction SWI1_cond (used for approving contracts etc) Options such as forwarding work item, within transaction SWI1_cond are disabled for the user.Pls suggest ways to enable the options for the u