Clear_record

Hi all
i have the following code in my post-record at the block level
DECLARE
    v_alert_button NUMBER;
    timer_id Timer;
  tm NUMBER(5) := 1;
BEGIN
   IF :global.record_status = 'CHANGED' THEN
        IF :global.exit_form ='NO' THEN 
           fnd_message.set_string('in record--'||:system.record_status);
           fnd_message.show();
          v_alert_button := SHOW_ALERT('UPDATE_RECORD'); -- "Do you want to update?"
      IF v_alert_button = ALERT_BUTTON2 THEN
            IF :system.record_status = 'INSERT' THEN
                 fnd_message.set_string('in insert--'||:system.record_status);
              fnd_message.show();
                 Clear_Record;
             fnd_message.set_string('after clear--'||:system.cursor_record);
              fnd_message.show();
            ELSE     
         :details.ITEM_NUMBER := GET_ITEM_PROPERTY(details.ITEM_NUMBER', DATABASE_VALUE);
         :details.DESCRIPTION := GET_ITEM_PROPERTY(details.DESCRIPTION', DATABASE_VALUE);
         :details.SN_FORMAT1 := GET_ITEM_PROPERTY(details.SN_FORMAT1', DATABASE_VALUE);
         :details.SN_FORMAT2 := GET_ITEM_PROPERTY(details.SN_FORMAT2', DATABASE_VALUE);
         :details.SN_FORMAT3 := GET_ITEM_PROPERTY(details.SN_FORMAT3', DATABASE_VALUE);
         Set_Record_Property( :SYSTEM.CURSOR_RECORD, 'details', STATUS, QUERY_STATUS);
         END IF;
         --RAISE FORM_TRIGGER_FAILURE;
      ELSIF v_alert_button = ALERT_BUTTON1 THEN
         timer_id := CREATE_TIMER('my_timer', tm, NO_REPEAT);
      END IF;
      :global.record_status := 'QUERY';
    END IF; 
   ELSE
      :global.record_status := 'QUERY';        
     end if;
END;     In the above code when i am inserting a new record and i navigate out of the record i fire an alert which asks whether the user wants to save his changes
if the user presses yes then the record is saved
if the user presses no then the record is not saved
but in case the user presses no the record should not be saved(which is working)
and also the record inserted should be cleared
which is what i am trying to do do from the above code
i have written a clear_record which seems that it is not working
Please help me
thanks
satish
Edited by: abcdxyz on Nov 18, 2010 11:54 AM

Hi,
     IF :system.record_status = 'INSERT' THEN
          fnd_message.set_string('in insert--'||:system.record_status);
     fnd_message.show();
          Clear_Record;As, you know that restricted built-in you can not be use in POST-RECORD trigger. So, create one more timer to perform the CLEAR_RECORD as below.
IF :system.record_status = 'INSERT' THEN
  fnd_message.set_string('in insert--'||:system.record_status);
  fnd_message.show();
  MyVariable:=CREATE_TIMER('MY_TIMER1',NO_REPEAT,10);
....and in WHEN-TIMER-EXPIRED use the code as below.
IF GET_APPLICATION_PROPERTY('TIMER_NAME')='MY_TIMER1' THEN
  CLEAR_RECORD;
ELSE  -- Here will work for the MY_TIMER
  -- Place the existing code here...
END IF;-Ammad

Similar Messages

  • Clear_record in Oracle Forms

    When I use clear_record in a block on a form the record seems to go away but it is still held in a buffer somehow. When the form saves the block to the database, the clear records are still there.
    Any idea what could be causing this?
    Here is part of the code.
    currRec := :system.cursor_record;
    SET_BLOCK_PROPERTY ('LINE', DELETE_ALLOWED, PROPERTY_TRUE);
    l_ordered_item_orig := Name_In(l_ordered_item);
    IF currRec <> '1' THEN
    first_record;
    loop
    l_ordered_item_cur := Name_In(l_ordered_item);
    IF (l_ordered_item_cur = l_ordered_item_orig) THEN
         l_line_num := Name_In(l_line_no);
         IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
    exit;
         ELSE
              Bell;
    fnd_message.set_name ('XXBHP', 'XXBHP_DUP_SO_LINE');
    fnd_message.set_token ('LINE', l_line_num, TRUE);
    l_num_message := fnd_message.question ('YES', NULL, 'NO', 2, 2, 'question');
    IF (l_num_message = 1) THEN
         --fnd_message.clear;
    go_record (currRec);
    --delete_record;
    clear_record;
    next_record;
    exit;
    ELSE
         exit;
    END IF;
    END IF;
    ELSE
    next_record;
    END IF;
    end loop;
    go_record (currRec);
    END IF;
    -- go back to the original record position
    end;

    Kellyb,
    I'm not sure you ever cleared the record. If you format your code snippet so it is easier to read:
    currRec := :system.cursor_record;
    SET_BLOCK_PROPERTY ('LINE', DELETE_ALLOWED, PROPERTY_TRUE);
    l_ordered_item_orig := Name_In(l_ordered_item);
    IF currRec '1' THEN
      first_record;
      loop
        l_ordered_item_cur := Name_In(l_ordered_item);
        IF (l_ordered_item_cur = l_ordered_item_orig) THEN
          l_line_num := Name_In(l_line_no);
          IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
            exit;
          ELSE
            Bell;
            fnd_message.set_name ('XXBHP', 'XXBHP_DUP_SO_LINE');
            fnd_message.set_token ('LINE', l_line_num, TRUE);
            l_num_message := fnd_message.question ('YES', NULL, 'NO', 2, 2, 'question');
            IF (l_num_message = 1) THEN
              --fnd_message.clear;
              go_record (currRec);
              --delete_record;
              clear_record;
              next_record;
              exit;
            ELSE
              exit;
            END IF;
          END IF;
        ELSE
          next_record;
        END IF;
      end loop;
      go_record (currRec);
    END IF; The very first thing it does is evaluate currREC. If it is 1 then it hits the logic. Perhaps you are not on record 1 when this logic is encountered. Have you run this in debug mode and checked to see what the value is for :SYSTEM.CURSOR_RECORD?

  • Clear_record in on-insert trigger

    Hi, I have a situation where if a user presses a button, enters some details then saves, a database package is called, it does some processing and returns a value. However if the value returned is say 'dont-insert', I want a message displayed. Then when the user presses ok the block should be cleared of the inputted values.
    At the moment I have the logic in the on-insert query on my block. It doesn't allow me to use clear_record in here because of the type of trigger it is. I was wondering if anyone has an alternative solution to this?
    So I'm basically looking for logic to:
    1. check the value returned from the database package
    2. if it says don't insert, display a message
    3 clear the changes entered by the user.
    thanks,
    Ian

    A when-button-pressed trigger might work, but that would miss the situation where the user presses the commit keyboard key.
    The right way would be to put the process (t+o call the db procedure, issue the message and clear the record+) into a form procedure. That procedure should then be called from the key-commit trigger.
    If you want a button, too, then its when-button-pressed trigger should ONLY do a Do_Key('COMMIT_FORM'); That command will cause it to run the key-commit trigger. If you don't want to create a procedure, you could put all the code into the key-commit trigger, as Slava Natapov suggested.

  • Why Clear_Record or Delete_record don't work???

    In a pre-text item trigger I have a call to a procedure that checks to see if a bill has already been entered.
    If it has already been entered, I want to clear OR delete the record.
    Here's the section of code:
    FOR v_procheck in c_procheck LOOP
    s_exists := 1;
    clear_record;
    message ('This freight bill has already been entered.');
    End Loop;
    I've tried it with delete record too, but neither do anything at all. I get the message okay, and I don't get any errors.
    I can clear or delete the record from the toolbar.
    Please help.
    Thanks.
    Lesley.
    null

    Thanks for your reply.
    That makes complete sense - but I wasn't getting any errors so it was baffling me. I removed the message and I still get no errors even with error trapping & displaying err_code, err_type etc. etc.
    How can I get around this? I need to check a bill once the first 3 fields are entered - in order to prevent unnecessary data entry. Then I want to clear the form and allow them to start over.
    I can't seem to find a way to do this. And to be honest I'm not exactly seeing clearly at this point!
    Thanks for your help.
    Lesley.

  • Print Report

    Dear guyz,
    How can i print directly to local connected Printer.
    i have develop cheque printing software, and i have Epson LQ-680 ESC/P 2 printer i want to print the report directly to this printer and this is not a default printer.
    i have the below code on forms to calling report even though it showing preview screen which i dont like when user press the button the it will print dirrectly to the above printer without showing anything on screen how can i do this? any help appreciate.
    i'm using oracle 6i
    code on button
    :PARAMETER.IDNO:=:IDNO;
    Run_product(reports,'K:\CHEQUES\Reports\ANB',synchronous,runtime,filesystem,'default',null);
    CLEAR_RECORD;Regards
    Moazam

    thx guyz,
    I Solved the matter.......
    Regards
    Moazam

  • How to save more than 2 records at a time in tabular form?

    I have a table name SAMPLE_TABLE, which has SNO,NAME items and one sequence name is SEQ_SAMPLE.
    i have one form based on SAMPLE_TABLE. my form is in tabular format, which has 5 records.
    in the layout wizard only NAME is displayed. SNO doesnot displayed.
    in the layout wizard, there is one push button named as SAVE.
    the code of SAVE button(When_Button_Pressed) is
    insert into sample_table values(seq_sample.nextval,:sample_table.name);
    clear_record;
    commit;
    my problem is :
    when ever i want to save one record at a time there is no problem.
    if i want to save more than 2 records at a time then sequence number is alloted for last record. other records have no sequence numbers.
    for example i want to insert 2 names as XYZ,PQR then
    the table look like this:
    sno name
    1 PQR
    XYZ
    if SNO is primary key then it doesnot work because of null value.
    can any one solve my problem?
    Thanks
    Meegada

    Is the block a database block or a control block,
    1. if database block, assign the primary key on a
    trigger like new record instance for each record
    enteredour's is a control block, ididnt get your point clearly
    could you make it clear how to assign a primary key on a trigger
    our criteria is we are having two block as lov_values and lov_name
    lov_values:
    lov_values_id (sequence generated)
    lov_id will be same for the all the values for a particular lov_name
    lov_values will be which we enter in the form which will be the only visuble colums on the form
    lov_name block:
    lov_name
    lov_id(sequence generated)
    could you help me with the code
    thanks
    prasad

  • HOW TO SAVE RECORDS MORE THAN ONE AT A TIME

    i have two blocks lov_name and lov_values
    lov_name contains
    lov_id(pk)sequence generated
    lov_name
    lov_values contains
    lov_id(fk)
    lov_values_id(pk) sequence generated
    lov_values
    i have the sequence names as lov_id & lov_id_values
    i have written the code for save button
    declare
    v_lov_id number;
    v_lov_val_id number;
    begin
    select lov_id.nextval into v_lov_id from lov_name;
    select lov_id_values.nextval into v_lov_val_id from dual;
    insert into lov_values values(v_lov_id,v_lov_val_id,:lov_values.lov_values);
    clear_record;
    commit;
    end;
    could you help me with the code to save more than one record at a time

    I would suspect this line
    select lov_id.nextval into v_lov_id from lov_name;
    i was getting lov_id value in to the feils but iwas not getting the value of lov_id_values
    how to run the sequence when inserting multiple records
    thanks
    prasad

  • Refresh block

    Hi all,
    I'm using Oracle Forms Builder 10GR2. I have a database block and a procedure which just updates the values of some fields in that DB block. The problem is that the new values don't appear immediately even i have specified commit in the procedure. I have to requery the database block to see the new values. Any ideas how this can be achieved? Also, i tried to specify an INTO clause for those fields but i think this is not working because of their database item property...
    In other block, which is not database, i have something like this :
    select <value> INTO :<field> FROM <table_name>and the value of that field is automatically refreshed. Is this going to work for db items? If yes, why i'm not able to compile my procedure when the syntax is the same as the non-db items? The error is : Bad bind variable....
    Thanks in advance,
    Bahchevanov.

    Hi, this is my procedure, it's simple:
    PROCEDURE set_control_balance (p_statement_header_id IN INTEGER, p_control_total_dr in integer, p_control_total_cr in integer
                                                                                  ,p_control_dr_line_count in integer,p_control_cr_line_count in integer
                                                                                  ,p_control_end_balance in integer )
       IS
      begin
            update ce.ce_statement_headers
                 set control_total_dr                = p_control_total_dr
                       ,control_total_cr            = p_control_total_cr
                       ,control_dr_line_count = p_control_dr_line_count
                       ,control_cr_line_count = p_control_cr_line_count
                       ,control_end_balance          = p_control_end_balance
                 where
                           statement_header_id      = p_statement_header_id
       exception
            when others then
            raise;
       END;i call the procedure in the WHEN-BUTTON-PRESSED trigger of a button like this:
    set_control_balance(:ce_statement_headers_all.statement_header_id
                                                                      ,:ce_statement_headers_all.CTRL_TOTAL_DR
                                                                      ,:ce_statement_headers_all.CTRL_TOTAL_CR
                                                                      ,:ce_statement_headers_all.CTRL_DR_LINE_COUNT
                                                                      ,:ce_statement_headers_all.CTRL_CR_LINE_COUNT
                                                                      ,:ce_statement_headers_all.CTRL_END_BALANCE);
    :SYSTEM.message_level := 25;
          COMMIT;
    CLEAR_RECORD;
    GO_BLOCK ('CE_STATEMENT_LINES');
                EXECUTE_QUERY;
          LAST_RECORD;
    HIDE_WINDOW ('XXBG_CE_STATEMENT_LINES_NEW');
    But before, pls create POST-COMMIT Trigger Form Level Sorry cannot found such trigger on form level... There is ON-COMMIT,POST-DATABASE-COMMIT,POST-FORM-COMMIT... which of them i have to use?
    Thanks in advance,
    Bahchevanov.

  • How to cancel delete in a block ?

    hi
    When we delete a record from a block, it disappear from block and when saved, it is comitted in database as well.
    I want to add 'cancel' functionality ie when i delete a record from block , and if i don't want to save it , or there is error in saving. i should cancel 'delete' and on this, block should get refreshed with original records which were before delete.
    At what 'trigger' i can execute querry to refresh block again
    null

    Hai
    Use DELETE_RECORD built in to remove from the block. The record is not directly removed from the database as soon as the delete record command is issued. It just marks the record as deleted. On the next immediate commit or rollback the action is taken. refer the help. Look for CLEAR_RECORD built in too.

  • How to clear a record of control block

    i have one control block with 2 items and the Max. records displayed property is set to 10.I have populated 5 records and now i want to clear one record, but the clear_record statement does not seem to be working. How to clear a record in a control block. Please help me out in this doubt of mine.

    You have probably moved focus to another block. You have to go_block and maybe go_record before using clear_block.

  • PROBLEM IN DELETE TRIGGER

    hiiii guy's
    i had made a form having two blocks and both these blocks are based on the same table and i had created a master detail relationship on this form
    Now i m trying to delete data only from the 2nd block
    if i m using the builtin function clear_record
    then when i m pressing this button the whole of my form is getting clear but i want to remove only one particular record from the second block only
    could someone plz help me out to remove this problem
    thanks guy's
    Edited by: Navdeep Kaur on Jul 23, 2009 10:52 PM

    Hi
    GO_block(blck_name);
    delete_record;
    Regards
    Vikas

  • Forms not prompting to save

    I created a form... and noticed that when I go to record and choose insert it.. insert record and then exit out of form it doesn't give me the prompt anymore to save.. I did get this message before but not anymore... what could be a possible fix for this issue..
    Thanks

    Before when I was working on this it asked me if I want to save changes or notCan you go back to the original version and try again? It is the default to ask if you want to commit, so you must have changed something somewhere, like exit_form(no_commit). Or maybe a clear_record?

  • Trouble with a create button - sequence

    I have created a sequence to assign to my Staff_id
    create sequence staff_id_sequence start with 3; (i have 2 staff already created)
    I have a manually created datablock with the information from my staff table
    staff_id
    s_last name
    s_first name
    etc.
    I have made a create_button which when pressed it should post the next value in the sequence so that I can input a new staff member.
    CLEAR_FORM;
    SELECT staff_id_sequence.nextval
    INTO :staff.staff_id
    FROM dual;
    SET_ITEM_PROPERTY('SAVE_BUTTON', ENABLED, PROPERTY_TRUE);
    When run the form and press create_button nothing happens. If i put a number in the textbox for staff_id and press create_button it gives me the next number in the sequence.
    Anyone know why it doesn't run until I fill the box with a number?

    hi
    try the following..
    CLEAR_record;
    select staff_id_sequence.nextval into :staff.staff_id
    from dual;
    set_item_property('save_button',ENABLED,PROPERTY_TRUE);sarah

  • Multi Record Block Problem

    Hi,
    I have a multi record block with two fields NAME and DATE. On clicking the Save Button a procedure (PROC_BEFORE_SAVE) is called which loops through this block, and deletes empty records.
    PROC_BEFORE_SAVE
    LOOP
         IF :TI_NAME IS NULL THEN
              DELETE_RECORD;
         END IF;
         NEXT_RECORD;
         EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
    END LOOP;
    The proc fails and throws error (Oracle Error Unable to Update Records) only for the case that the first few records are null. Sample data given below.
    Name  -  Date
    NULL  -  NULL
    NULL  -  NULL
    NULL  -  NULL
    AJ  -  10/02/2005
    JA  -  12/12/2004
    AJV  -  12/12/2002
    This happens because it tries to update the NOT NULL field NAME as NULL.
    Could somebody please tell me why this is happening? Is there something wrong with the procedure?
    I am using Oracle Forms 6.0.8.8.0 in Windows 2000 Professional edition.
    Any help would be greatly appreciated.
    Thanks,
    Anoop

    Hi,
    Thanks for the reply. But CLEAR_RECORD also doesn't seem to work.
    Thanks,
    Anoop

  • Oracle 9i Forms

    I have a form was converted from Oracle forms version 4.5 (character mode) to the 9i forms. it has a multi-record block. The first field on that block is a date field for user to enter a valid date. Please see the codes below,
    ==========================================================
    :PARAMETER.ITM_FLG := 'T';
    if :dummy_date_received_pos is null then
    if :pmn_document_activity.date_activity_due is null and
    :pmn_document_activity.document_reason_code is null
    then
    CLEAR_RECORD;
    :dummy.question := 'Do you want to store what was
    entered?';
    :PARAMETER.blk_FLG := 'T';
    GO_ITEM('dummy.yes_no');
    else
    message('Date Received can not be blank.');
    :PARAMETER.ITM_FLG := 'F';
    end if;
    else --:dummy_date_received_pos is not null
    end if;
    =========================================================
    When I enter an invalid date (example:adfdas or 01-FFF-2004) why the logic does not go to the "ELSE --:DUMMY_DATE_RECEIVED_POS IS NOT NULL" section? It actually went to the "IF :DUMMY_DATE_RECEIVED_POS IS NULL" section. Any ideas?
    Please Help - Patty

    Thanks Rino.
    Your answer got me going one step further. however I am getting an error that page cannot be displayed because of some extra characters added to my URL as followed: http://%%20" (see below).
    This is what's showing up as my url in the browser:
    http://%%20"http://RZEPHIRW2K.rxsd.corp.numico.com:8888/forms90/f90servlet...."
    When I delete the extra characters, everything runs fine but I keep getting into this situation every time I run a form. It's anoying. Do you have any idea.
    Thanks,
    Rudy

Maybe you are looking for