This discussion is archived
11 Replies Latest reply: May 2, 2012 10:07 AM by devuser RSS

Forms 6i - How to execute query after Save

devuser Newbie
Currently Being Moderated
Hi,

After the 'Save' icon is pressed, I need to make the current block perform execute query. How do I accomplish that?

forms version = 6i

Thanks.
  • 1. Re: Forms 6i - How to execute query after Save
    HamidHelal Guru
    Currently Being Moderated
    user12021655 wrote:
    Hi,

    After the 'Save' icon is pressed, I need to make the current block perform execute query. How do I accomplish that?
    Press on execute query icon in the icon menu.

    If you want it automatically, write Post-Insert or Post-commit trigger at form level and write
    execute_query;
    Hope this helps
  • 2. Re: Forms 6i - How to execute query after Save
    vansul Pro
    Currently Being Moderated
    write EXECUTE_QUERY; in the Post-Commit trigger
  • 3. Re: Forms 6i - How to execute query after Save
    Amatu Allah Guru
    Currently Being Moderated
    Hi

    In order to make changes u have made take effects in the CURRENT or the same data block then as mentioned before pls use POST-COMMIT or POST-INSERT the following Built-ins...
    CLEAR_BLOCK;
    EXECUTE_QUERY;
    Hope this helps...

    Regards,

    Amatu Allah
  • 4. Re: Forms 6i - How to execute query after Save
    devuser Newbie
    Currently Being Moderated
    Thank you all very much.

    When I add a trigger POST-UPDATE in either block or form level, I get this error mesasge:

    Illegal restricted procedure GO_BLOCK in POST-UPDATE trigger.

    Similar error is thrown for the POST-INSERT trigger.

    Thank you.
  • 5. Re: Forms 6i - How to execute query after Save
    Amatu Allah Guru
    Currently Being Moderated
    Hi

    Create a Timer inside ur POST-INSERT Trigger and create a WHEN-TIMER-EXPIERED Trigger Form-Level to write ur built-ins

    u can use the trick of a timer in POST-UPDATE or in POST-INSERT trigger as follow...
     
    
    DECLARE
     
      vTimer TIMER;
     
    BEGIN
     
      vTimer:=CREATE_TIMER('TEMP',10,NO_REPEAT);
     
    END;
     
    In Form-level create WHEN-TIMER-EXPIRED Trigger use ...

     
    GO_BLOCK ('BLOCK_NAME');
    EXECUT_QUERY;
    DELETE_TIMER('TEMP');
     
    Hope this helps...

    Regards,

    Amatu Allah.
  • 6. Re: Forms 6i - How to execute query after Save
    devuser Newbie
    Currently Being Moderated
    Thank you.

    Actually there are several tab pages in my form. Each tab is based on a table/tables. So when ther user presses the save icon (or saves the changes), the current tab(block) needs to be re-queried to display the current state of the base table.
    Thank you.
  • 7. Re: Forms 6i - How to execute query after Save
    Srikkanth.M Pro
    Currently Being Moderated
    Hi,

    So as per you requirement, the user will made some changes ie (updates in table) and the updated data need to reflect on the block immediately.

    So you can use onetime_where clause property,i have faced this problem and its get solved by using it.

    set_block_property('You_block_name',ONETIME_WHERE,'Any Primary Key Field='||:Block.Field_name);
    go_block('Block_name');
    execute_query;

    You can also refer the user guide and check how this works.

    Thanks & Regards
    Srikkanth
  • 8. Re: Forms 6i - How to execute query after Save
    AmmadAhmed Guru
    Currently Being Moderated
    Hello,
    user12021655 wrote:
    the current tab(block) needs to be re-queried to display the current state of the base table.
    If user is making any changes and pressing save than this would be the current state. What do you exactly mean by current state of base table. If user is expecting changes from any other user than can press execute query (F8) why needs save??

    Anyways, the thing you are asking can be done by creating one trigger on form-level called KEY-COMMIT and the code as below...
    COMMIT;
    EXECUTE_QUERY;
    It will do the execute query on the current block where the cursor exists.

    -Ammad
  • 9. Re: Forms 6i - How to execute query after Save
    Amatu Allah Guru
    Currently Being Moderated
    user12021655 wrote:
    Thank you.

    Actually there are several tab pages in my form. Each tab is based on a table/tables. So when ther user presses the save icon (or saves the changes), the current tab(block) needs to be re-queried to display the current state of the base table.
    Thank you.
    Hi user12021655

    Well,now it's different solution , then we should follow this trick...

    Pls create stack canvas for each tabpage on a content canvas and create stack1 for tab_page 1 and stack2 for tab_page 2 , etc.

    IN BOTH WHEN-TAB-CHANGED-TRIGGER AND  KEY COMMIT Trigger whatever u want to execute the query on pls use the following code as an example ;
    Meaning u have customize it according 2 ur needs it's just an example to replace the name of ur tabs ,canvas names according to ur requirement applied
    DECLARE
    
    V_TapPage_Name VARCHAR2(100);
    
    BEGIN
    
    
    SHOW_VIEW('TABCANVAS');
    
    V_TapPage_Name :=GET_CANVAS_PROPERTY('TAB_CANVAS_NAME',TOPMOST_TAB_PAGE);
    
    IF V_TapPage_Name = 'TP_1' THEN
    
    -- For tab1 When changed Then the item should be visible and navigable in the stacked canvas which resides on the tab1
    
    GO_ITEM('BLOCK_NAME.ITEM_NAME'); 
    
    SHOW_VIEW('STACK1');
    
    HIDE_VIEW('STACK2');
    
    EXECUTE_QUERY;
    
    -- For tab2 When changed Then the item  should be visible and navigable in the stacked canvas which resides on the tab2
    
    ELSIF V_TapPage_Name = 'TP_2' THEN
    
    GO_ITEM('BLOCK_NAME.ITEM_NAME');
    SHOW_VIEW('STACK2');
    HIDE_VIEW('STACK1');
    
    EXECUTE_QUERY;
    
    ---- and the LIKE ----
    
    END IF;
    
    END;
    Hope this helps...

    Regards,

    Amatu Allah
  • 10. Re: Forms 6i - How to execute query after Save
    Sarah Guru
    Currently Being Moderated
    hi


    what i understand from you,you can just use the following in.


    when-button-pressed trigger.
    ----------------------------
    
    
    execute_query;
    sarah
  • 11. Re: Forms 6i - How to execute query after Save
    devuser Newbie
    Currently Being Moderated
    Thank you very much.

    The suggestion to put EXECUTE_QUERY; statement in the form-level KEY-COMMIT trigger provided the requireed solution.

    Thank you all for your suggestions.

Legend

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