6 Replies Latest reply: Jan 7, 2014 4:22 AM by Hoek RSS

    Can i code for , IF SYSTEM.MODE='EXECUTE-QUERY' THEN DO_SOMETHING.

    Vijetha

      Hi all,

       

      I wanted to know one thing.

       

      Like we code

       

      IF :System.Mode = 'NORMAL' THEN
        DO SOMETHING;

      ELSE
        EXECUTE_QUERY
      ;
      END IF;

       

      OR

       

      IF :System.Mode = 'ENTER-QUERY' THEN
        EXECUTE_QUERY;

      ELSE
        DO SOMETHING;

      END IF;


      Can we code like below for 'EXECUTE-QUERY' ????

      IF :System.Mode = 'EXECUTE-QUERY' THEN
        DO SOMETHING;

      END IF;


      Please let me know, I acctually tried & its not working, its neither showing any error.

      Help me.

      Thank You.


      Oracle Forms 6i.

      Oracle 9i.

        • 1. Re: Can i code for , IF SYSTEM.MODE='EXECUTE-QUERY' THEN DO_SOMETHING.
          tony.g

          Hi

           

          If you look at the forms help that comes with the Forms Developer tool you will see that :system.mode had three values

           

          NORMAL

          ENTER-QUERY

          QUERY

           

          I think the last value is the one you are looking for.

           

          Tony


          • 2. Re: Can i code for , IF SYSTEM.MODE='EXECUTE-QUERY' THEN DO_SOMETHING.
            Vijetha

            No i am looking for 'EXECUTE-QUERY' only.

            I want to code when :System.Mode = 'EXECUTE-QUERY' .

            So please let me know how do i code when system is in Execute_query mode.

            • 3. Re: Can i code for , IF SYSTEM.MODE='EXECUTE-QUERY' THEN DO_SOMETHING.
              Hoek

              EXECUTE-QUERY doesn't exist. You're probably looking for QUERY and you should read the Form Builder help documentation:

               

              SYSTEM.MODE indicates whether the form is in Normal, Enter Query, or Fetch Processing mode. The value is always a character string. ValueDescriptionNORMALIndicates that the form is currently in normal processing mode. ENTER-QUERYIndicates that the form is currently in Enter Query mode. QUERYIndicates that the form is currently in fetch processing mode, meaning that a query is currently being processed.

              • 4. Re: Can i code for , IF SYSTEM.MODE='EXECUTE-QUERY' THEN DO_SOMETHING.
                Vijetha

                Thank You Hoek.

                QUERY Indicates that the form is currently in fetch processing mode, meaning that a query is currently being processed.

                 

                You say 'QUERY' is when data is being fetched.

                What mode will be the system in , after the fetching is over???

                Will it come back to the 'NORMAL' mode?? Or will it still be 'QUERY' mode??

                 

                I actually want to code after execute_query is pressed but when the fetching of data is over.

                • 5. Re: Can i code for , IF SYSTEM.MODE='EXECUTE-QUERY' THEN DO_SOMETHING.
                  Hoek

                  Sounds like you could use a post-query trigger instead?

                  • 6. Re: Can i code for , IF SYSTEM.MODE='EXECUTE-QUERY' THEN DO_SOMETHING.
                    Vijetha

                    Thank You so much. I'll try it out.

                    -------------------------------------------------------------------------

                    Actually not solving my purpose.

                    I have a form with one data block MATURED_FD_DTL which looks like below:

                     

                    ACCT_FD_NO

                    CUST_CODE

                    FD_AMT

                    FD_INT_BAL

                    TDS

                    CHQ_NO

                    ADD_FD_AMT

                    P_SAP_CODE

                    P_TYPE

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                     

                    CREATE TABLE MATURED_FD_DTL

                    (

                      ACCT_FD_NO    VARCHAR2(17 BYTE)               NOT NULL,

                      CUST_CODE     NUMBER(9),

                      FD_AMT        NUMBER(15),

                      FD_INT_BAL    NUMBER(15),

                      TDS           NUMBER(15),

                      CHQ_NO        NUMBER(10),

                      ADD_FD_AMT    NUMBER(15),

                      P_SAP_CODE    NUMBER(10),

                      P_TYPE        VARCHAR2(1 BYTE)

                    );

                     

                    I don't want the user to enter values already present in database in ACCT_FD_NO column ,

                    so as soon as the data is enter in that field & press next item, I want to display an error message saying its a Duplicate value

                    & raise form trigger failure & not allow to update.

                    So i put in the following code for ACCT_FD_NO, Trigger:KEY_NEXT_ITEM:

                     

                    DECLARE

                      CUST_CODE NUMBER;

                      FD_AMT NUMBER;

                      SAP_CODE NUMBER;

                      CHECK_DUPLICATE NUMBER;

                      V_COUNT NUMBER;

                    BEGIN

                    IF :SYSTEM.MODE = 'NORMAL' THEN

                      CHECK_DUPLICATE:=:MATURED_FD_DTL.ACCT_FD_NO;

                     

                      SELECT COUNT(*) INTO V_COUNT FROM MATURED_FD_DTL WHERE ACCT_FD_NO=CHECK_DUPLICATE;

                      IF V_COUNT>=1 THEN

                      MESSAGE('YOU HAVE ENTERED AN EXISTING ACCOUNT FD NO : '||CHECK_DUPLICATE);

                      MESSAGE(' ');

                      RAISE FORM_TRIGGER_FAILURE;

                      ELSE

                     

                      SELECT ACCT_CUST_CODE, AMOUNT INTO CUST_CODE, FD_AMT

                      FROM KEC_FDACCT_MSTR WHERE ACCT_FD_NO = :ACCT_FD_NO;

                     

                     

                      :CUST_CODE := CUST_CODE;

                      :FD_AMT := FD_AMT;

                       GO_ITEM('MATURED_FD_DTL.FD_INT_BAL');

                      :CREATED_DATE := SYSDATE;

                      :CREATED_BY := :GLOBAL.USER_ID;

                     

                     

                      END IF;

                     

                    ELSIF :SYSTEM.MODE = 'ENTER-QUERY' THEN

                      EXECUTE_QUERY;

                      GO_ITEM('MATURED_FD_DTL.CUST_CODE');

                    ELSIF :SYSTEM.MODE = 'QUERY' then

                      GO_ITEM('MATURED_FD_DTL.CUST_CODE');

                    END IF;

                    END;

                     

                    The purpose of not allowing duplicate value is done.

                    But if I press enter_query & execute_query to see all the values,all the values get populated.

                    When i move cursor from one field to another by using tab or right arrow button through keyboard,

                    then it shows that Message that is 'YOU HAVE ENTERED AN EXISTING ACCOUNT FD NO :value'.

                    So i want this to happen only when i enter the data (or say when in NORMAL Mode)

                    and not when i do 'ENTER_QUERY, EXECUTE_QUERY and also POST_QUERY.

                     

                    So how do i do this??

                    Please help me.

                    Thank You.