This discussion is archived
4 Replies Latest reply: Oct 1, 2013 3:36 AM by Dev. Musbah RSS

Auditing code does not work!!

Dev. Musbah Newbie
Currently Being Moderated

Hi All,

I'm trying to use this code to save data in a table by pressing a button in a non database data block (for auditing purpose):

 

loop

     if :system.cursor_value is not null then

          insert into tab(col1,col2) values (:system.cursor_item, :system.cursor_value);

     end if;

     next_item;

     commit;

     exit when :system.cursor_value is null;

end loop;

 

but this code doesn't save any data in tab table! Why? and how to solve this problem?

Thank you

 

Note: I'm using Oracle DB 10g, Forms 6i

  • 1. Re: Auditing code does not work!!
    Dev. Musbah Newbie
    Currently Being Moderated

    No one can help me in this?

  • 2. Re: Auditing code does not work!!
    Q_STEPHENSON Newbie
    Currently Being Moderated

    Hi Dev

     

    It is not working because :system.cursor_value will be null, .  The focus of the :system.cursor_item will be on the button, which has no cursor_value value.  A simple way to test it would be to add the following debug to your code when you press the button i.e. the when-button-pressed trigger.

     

    message(:system.cursor_item ||' :: '||:system.cursor_value,acknowledge);

     

    Solution1:

    1. If you have to have a the data block as a control/NBT block then Issue a go_item() or a go_block() to the block containing the data.

    2. Why not just change block with the data into a real data block and change the code on the button to just perform a COMMIT_FORM;  Create a when-validate-item at block level that will validate each item getting the item name (alternatively you could place the trigger against each item that is validating).

     

    Regards

    Quintin

  • 3. Re: Auditing code does not work!!
    PavelA-o. Newbie
    Currently Being Moderated

    Instead of :system  variables I would use the exact block and item name's. From your post is not clear why you don't do that but use cursor_value instead.

    You can try to set button's property "Mouse navigable" to "no". The item with data will not lose focus and system.cursor_value may work. Also consider setting "Keyboard navigable" property to "No" because user can press this button using keyboard.

    Some clearance on what and why you are trying to do may issue a more useful answer

  • 4. Re: Auditing code does not work!!
    Dev. Musbah Newbie
    Currently Being Moderated

    You are right Q_Stephenson,

    I've used your hints specially :system.cursor_value like this: if :system.cursor_value = 'someblock.someitem' -- the last text item in someblock block, and go_block  also. Thank you

    Dear Pavela,

    I've used :system variables because I want to save every value enterd in any text item in a table in the database (for auditing purpose), I don't want to use that routine way which return block_name.item_name suppose the block contains 50 text items in this case I have to write 50 statements!. Thank you for your help

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points