8 Replies Latest reply: Dec 21, 2013 1:56 AM by HamidHelal RSS

    What exactly is happening in the code mentioned?????

    Vijetha

      Hi all,

       

      I want to know the working of the below code:

       

      The below code is the WHEN_BUTTON_PRESSED Trigger for the ENTER_QUERY (Push Button):

      DECLARE

        IT_ID1 ITEM;

        IT_ID2 ITEM;

        IT_ID3 ITEM;

       

      BEGIN

        IT_ID1 := FIND_ITEM('BUTTON.EN_QUERY');

        IT_ID2 := FIND_ITEM('BUTTON.CA_QUERY');

        IT_ID3 := FIND_ITEM('BUTTON.EX_QUERY');

        SET_ITEM_PROPERTY(IT_ID3,ENABLED,PROPERTY_TRUE);

        if :system.mode<>'ENTER-QUERY' THEN

         set_item_property (it_id1,label,'CANCEL QUERY');

         GO_BLOCK(GET_APPLICATION_PROPERTY(CURRENT_FORM_NAME));

         CLEAR_BLOCK(NO_VALIDATE);

         ENTER_QUERY;

        set_item_property (it_id1,label,'ENTER QUERY');

        ELSE

        EXIT_FORM;

        END IF;

      END;

       

      Can You please tell me what exactly is happening in the above code?

      I want to know the working of it. Help me plz.

      Thank You.

       

      Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production

      Oracle Forms 6i.

        • 1. Re: What exactly is happening in the code mentioned?????
          Hoek

          This is Forms code, so read about it in the Forms Help or go to the forms forum/space @ Forms

          . It has nothing to do with database SQL and PL/SQL.

           

          Message was edited by: Hoek

          • 2. Re: What exactly is happening in the code mentioned?????
            Vijetha

            Ok, Thank You. Moved it to Forms Forum.

            • 3. Re: What exactly is happening in the code mentioned?????
              Andreas Weiden

              What is the part you do not understand?

              • 4. Re: What exactly is happening in the code mentioned?????
                HamidHelal

                Hello vijetha,

                 

                Go to form builder help menu and search for FIND_ITEM builtin and see the example, same for SET_ITEM_PROPERTY,   system, go_block, enter_query


                Hope you get all you need.


                Thanks


                Hamid

                • 5. Re: What exactly is happening in the code mentioned?????
                  Vijetha

                  I'm confused with that code, actually i dont understand whats it trying to do??

                  what does if :system.mode<>'ENTER-QUERY' THEN mean??

                  and what does GO_BLOCK(GET_APPLICATION_PROPERTY(CURRENT_FORM_NAME)); do?

                  As per the code, After i press the button, the label ENTER QUERY should become CANCEL QUERY, (that is when system is in ENTER_QUERY mode) .

                  So when in the system is in ENTER_QUERY mode, it must display CANCEL QUERY, Right??

                  Then why the code, (if :system.mode<>'ENTER-QUERY' THEN set_item_property (it_id1,label,'CANCEL QUERY');) ?? which says if system mode is not equal to ENTER_QUERY,

                  then it tells to display CANCEL QUERY.

                  • 6. Re: What exactly is happening in the code mentioned?????
                    HamidHelal

                    what does if :system.mode<>'ENTER-QUERY' THEN mean??

                    SYSTEM.MODE indicates whether the form is in Normal, Enter Query, or Fetch Processing mode. The value is always a character string.

                     

                    and what does GO_BLOCK(GET_APPLICATION_PROPERTY(CURRENT_FORM_NAME)); do?

                    GET_APPLICATION_PROPERTY Returns information about the current Oracle Forms application. CURRENT_FORM_NAME Returns the name of the current form as indicated by the form module Name property.

                    GO_BLOCK navigates to an indicated block. If the target block is non-enterable, an error occurs.

                     

                    As per the code, After i press the button, the label ENTER QUERY should become CANCEL QUERY, (that is when system is in ENTER_QUERY mode) .

                    So when in the system is in ENTER_QUERY mode, it must display CANCEL QUERY, Right??

                    in your post, you also said..

                     

                    The below code is the WHEN_BUTTON_PRESSED Trigger for the ENTER_QUERY (Push Button):

                     

                    We see 3 button in your code. How can we know which one is ENTER_QUERY button. Your code says...

                    ENTER_QUERY;

                      set_item_property (it_id1,label,'ENTER QUERY');

                    So, it says.. BUTTON.EN_QUERY label will be ENTER QUERY



                    Then why the code, (if :system.mode<>'ENTER-QUERY' THEN set_item_property (it_id1,label,'CANCEL QUERY');) ?? which says if system mode is not equal to ENTER_QUERY,

                    then it tells to display CANCEL QUERY.

                    it says.. BUTTON.EN_QUERY label will be CANCEL QUERY

                    • 7. Re: What exactly is happening in the code mentioned?????
                      Vijetha

                      There is only one button for 'ENTER_QUERY', Only the label becomes 'CANCEL_QUERY' when the button is pressed. Ok.

                      This happens when i run the form.

                      But in the code, its like below :

                      if :system.mode<>'ENTER-QUERY' THEN

                         set_item_property (it_id1,label,'CANCEL QUERY');

                      (which actually says when system is not in ENTER_QUERY, then label as CANCEL_QUERY.

                      But code must be like when system is in ENTER_QUERY, then label as CANCEL_QUERY.

                      That is what is confusing..

                      • 8. Re: What exactly is happening in the code mentioned?????
                        HamidHelal

                        There is only one button for 'ENTER_QUERY', Only the label becomes 'CANCEL_QUERY' when the button is pressed. Ok.

                         

                        in your posted code, we see

                          IT_ID1 := FIND_ITEM('BUTTON.EN_QUERY');

                          IT_ID2 := FIND_ITEM('BUTTON.CA_QUERY');

                          IT_ID3 := FIND_ITEM('BUTTON.EX_QUERY');

                        it indicate there is 3 item int the button block.

                         

                         

                        There is only one button for 'ENTER_QUERY', Only the label becomes 'CANCEL_QUERY' when the button is pressed. Ok.

                        This happens when i run the form.

                        But in the code, its like below :

                        if :system.mode<>'ENTER-QUERY' THEN

                           set_item_property (it_id1,label,'CANCEL QUERY');

                        (which actually says when system is not in ENTER_QUERY, then label as CANCEL_QUERY.

                        But code must be like when system is in ENTER_QUERY, then label as CANCEL_QUERY.

                        That is what is confusing..

                        this code says... IF mode is not in enter_query then set button.en_query labels to Cancel Query


                        Test your code and if get anythings wrong the re-arrange the code.