9 Replies Latest reply on Feb 12, 2008 2:06 PM by DejanH

    Execute_query and go_item

    DejanH
      Hello.

      I have a master-detail form.
      And i have key-exeqry trigger. Here i have execute_query built-in and then go_item.

      But when i execute_query, cursor doesn't jump to item i specified in go_item.

      For testing i created timer which waits for 1 second after execute_query. In when-timer-expired trigger i use the same go_item. After timer expires then go_item works.

      Can anyone help me with that? I don't want to use timer.

      Any idea?

      Thanks.
        • 1. Re: Execute_query and go_item
          Fabrizio Delli Priscoli
          Try to put your statement in a post-query trigger.
          Hope it helps you,
          Fabrizio
          • 2. Re: Execute_query and go_item
            DejanH
            You can't use go_item in post-query trigger.
            • 3. Re: Execute_query and go_item
              Fabrizio Delli Priscoli
              Are you sure?
              I have seen the online help and there is nothing about it..
              Here is the online help.

              Post-Query Trigger Description
              When a query is open in the block, the Post-Query trigger fires each time Oracle Forms fetches a record into a block. The trigger fires once for each record placed on the block's list of records.
              Definition Level form or block Legal Commands SELECT statements, unrestricted built-ins Enter Query Mode no
              Usage Notes Use a Post-Query trigger to perform the following tasks: populate control items or items in other blocks calculate statistics about the records retrieved by a query calculate a running total When you use a Post-Query trigger to SELECT non-base table values into control items, Oracle Forms marks each record as CHANGED, and so fires the When-Validate-Item trigger by default. You can avoid the execution of the When-Validate-Item trigger by explicitly setting the Status property of each record to QUERY in the Post-Query trigger. To set record status programmatically, use SET_RECORD_PROPERTY . On Failure Oracle Forms flushes the record from the block and attempts to fetch the next record from the database. If there are no other records in the database, Oracle Forms closes the query and waits for the next operator action. Fires In Fetch Records Post-Query Trigger Examples Example This example retrieves descriptions for code fields, for display in non-database items in the current block. DECLARE CURSOR lookup_payplan IS SELECT Payplan_Desc FROM Payplan WHERE Payplan_Id = :Employee.Payplan_Id; CURSOR lookup_area IS SELECT Area_Name FROM Zip_Code WHERE Zip = :Employee.Zip; BEGIN /* ** Lookup the Payment Plan Description given the ** Payplan_Id in the Employee Record just fetched. ** Use Explicit Cursor for highest efficiency. */ OPEN lookup_payplan; FETCH lookup_payplan INTO :Employee.Payplan_Desc_Nondb; CLOSE lookup_payplan; /* ** Lookup Area Descript given the Zipcode in ** the Employee Record just fetched. Use Explicit ** Cursor for highest efficiency. */ OPEN lookup_area; FETCH lookup_area INTO :Employee.Area_Desc_Nondb; CLOSE lookup_area; END
              • 4. Re: Execute_query and go_item
                544725
                You can't use the commads "go_block", "go_item", etc, in the triggers "post-query", "when_validate_item", "post_change"....
                • 5. Re: Execute_query and go_item
                  Scott Hollows
                  You have done the correct thing. GO_ITEM does work in KEY-EXEQRY. You dont need a timer to get it to work

                  so in KEY-EXEQRY you can have

                  execute_query;
                  go_item ('EMP.LAST_NAME);

                  Are you sure the trigger is firing and the code is executing ? Use the debugger or add MESSAGE calls to confirm that it is firing. Maybe you have a block level trigger that is overriding the form level trigger or vice versa

                  Also - post the trigger code here
                  • 6. Re: Execute_query and go_item
                    450441
                    Legal Commands SELECT statements, unrestricted built-ins
                    Go_Item is a restricted built-in.
                    • 7. Re: Execute_query and go_item
                      450441
                      The go_item could be failing for whatever reason. Try adding an

                      IF NOT form_success THEN
                      pause;
                      END IF;

                      after the go_item and see if you get a dialog box up.
                      • 8. Re: Execute_query and go_item
                        DejanH
                        Is seems as the go_item would fire sooner than detail block is filled with data.
                        Cursor jumps to detail block before detail block data is queried.

                        Why is that happening?
                        • 9. Re: Execute_query and go_item
                          DejanH
                          Any idea?


                          Message was edited by:
                          DejanH

                          Message was edited by:
                          DejanH