Solved

How can I allow for query mode?

Posted on 2006-07-18
13
2,807 Views
Last Modified: 2008-01-09
I have a form which has three radio buttons, 'A', 'B' and 'F' which have a WHEN-RADIO-CHANGED trigger attached to them. When the user clicks on the 'F' radio button, I want it to take certain actions if the user is entering a new script into the form.The content of the trigger is listed below. However, the problem arises when the user is in query mode and clicks on the radio button, for example, if the user wants to do a search on scripts of type 'A', 'B' or 'F'. When this happens, the following error pops up: "FRM-41009: Function key not allowed. Press Ctrl+F1 for list of valid keys."  What I would like is for the code in the trigger to be bypassed if the user is in query mode by inserting an IF statement, e.g., IF "user NOT in query-mode THEN execute the code in the trigger." How do I check whether the user is in query mode?

Content of Trigger:

BEGIN
      IF :a.a_type = 'F' THEN
         GO_BLOCK('c_a');
             :a.a_columns := Null;
         Set_Status('P');
         IF :GLOBAL.database_instance <> 'MAIN' THEN
           set_item_property('a.a_reviewed_ind',enabled,property_true);
           set_item_property('a.a_reviewed_ind',update_allowed,property_true);
           GO_BLOCK('a');
         END IF;
      ELSE
            Set_Status('A');
            set_item_property('c_a.execute_script_btn', ENABLED, PROPERTY_TRUE);
            IF :GLOBAL.database_instance <> 'MAIN' THEN
          set_item_property('a.a_reviewed_ind',enabled,property_false);
          :a.a_reviewed_ind := 'N';
          :a.a_reviewed_user := Null;
          GO_BLOCK('a');
        END IF;
      END IF;
END;
0
Comment
Question by:geeta_m9
  • 4
  • 4
  • 3
  • +1
13 Comments
 
LVL 25

Expert Comment

by:jrb1
ID: 17131337
I haven't used forms, but I found this suggestion.  Create an on error trigger to capture the error:

DECLARE
  ERR_VAL NUMBER(5)     := ERROR_CODE;
  MSG     VARCHAR2(150)
          := SUBSTR('   '||ERROR_TYPE||'-'||TO_CHAR(ERR_VAL)||': '
                                     ||ERROR_TEXT,1,150);
BEGIN
  IF ERR_VAL=41009 THEN
      null;
  ELSE
    MESSAGE(MSG);
    RAISE FORM_TRIGGER_FAILURE;
  END IF;
END;
0
 
LVL 14

Expert Comment

by:sathyagiri
ID: 17131367
I don't think there is a direct way of doing it.

However you could set a global variable or pass a parameter to your form while in query mode and use that variable to base your if condition
0
 

Author Comment

by:geeta_m9
ID: 17131413
Jrb1, where would I put that code? Would I put it in the WHEN_RADIO_CHANGED trigger?
0
 

Author Comment

by:geeta_m9
ID: 17131437
Sathyagiri, so in other words, I would have to assign the global variable the value when the user presses the F7 key or is there any other way to do it?
0
 
LVL 25

Expert Comment

by:jrb1
ID: 17131445
You'd put that on the ON-ERROR trigger on your form.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 17131463
?? you could read out a blockproperty which says that the block is currently in query-mode

well, no forms on hand, but i guess the property sounds like status

meikl ;-)
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 25

Expert Comment

by:jrb1
ID: 17131486
You also may be able to catch the error in the trigger code itself.

BEGIN
     IF :a.a_type = 'F' THEN
        GO_BLOCK('c_a');
           :a.a_columns := Null;
        Set_Status('P');
        IF :GLOBAL.database_instance <> 'MAIN' THEN
          set_item_property('a.a_reviewed_ind',enabled,property_true);
          set_item_property('a.a_reviewed_ind',update_allowed,property_true);
          GO_BLOCK('a');
        END IF;
     ELSE
          Set_Status('A');
          set_item_property('c_a.execute_script_btn', ENABLED, PROPERTY_TRUE);
          IF :GLOBAL.database_instance <> 'MAIN' THEN
         set_item_property('a.a_reviewed_ind',enabled,property_false);
         :a.a_reviewed_ind := 'N';
         :a.a_reviewed_user := Null;
         GO_BLOCK('a');
       END IF;
     END IF;
EXCEPTION
  WHEN ERROR_CODE=41009 THEN
     NULL
  ELSE
     RAISE Form_Trigger_Failure;
END;
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 17131495
a bit recherche on the net

BEGIN
   if get_block_property('c_a',STATUS) != 'QUERY' then -- inserted
     IF :a.a_type = 'F' THEN
        GO_BLOCK('c_a');
           :a.a_columns := Null;
        Set_Status('P');
        IF :GLOBAL.database_instance <> 'MAIN' THEN
          set_item_property('a.a_reviewed_ind',enabled,property_true);
          set_item_property('a.a_reviewed_ind',update_allowed,property_true);
          GO_BLOCK('a');
        END IF;
     ELSE
          Set_Status('A');
          set_item_property('c_a.execute_script_btn', ENABLED, PROPERTY_TRUE);
          IF :GLOBAL.database_instance <> 'MAIN' THEN
         set_item_property('a.a_reviewed_ind',enabled,property_false);
         :a.a_reviewed_ind := 'N';
         :a.a_reviewed_user := Null;
         GO_BLOCK('a');
       END IF;
     END IF;
  end if;  --inserted
END;

not tested

meikl ;-)
0
 
LVL 14

Expert Comment

by:sathyagiri
ID: 17131544
You will put it in the ENTER-QUERY_MODE trigger I guess. Not sure.
0
 
LVL 27

Assisted Solution

by:kretzschmar
kretzschmar earned 50 total points
ID: 17131548
hmm, sorry not sure about above,

the property could also be mode and the result 'ENTER-QUERY'
will validate tomorrow

meikl ;-)
0
 
LVL 25

Accepted Solution

by:
jrb1 earned 125 total points
ID: 17131578
You can try this....


BEGIN
   if :system.mode = 'ENTER-QUERY' then
     null;
   else      
     IF :a.a_type = 'F' THEN
        GO_BLOCK('c_a');
           :a.a_columns := Null;
        Set_Status('P');
        IF :GLOBAL.database_instance <> 'MAIN' THEN
          set_item_property('a.a_reviewed_ind',enabled,property_true);
          set_item_property('a.a_reviewed_ind',update_allowed,property_true);
          GO_BLOCK('a');
        END IF;
     ELSE
          Set_Status('A');
          set_item_property('c_a.execute_script_btn', ENABLED, PROPERTY_TRUE);
          IF :GLOBAL.database_instance <> 'MAIN' THEN
         set_item_property('a.a_reviewed_ind',enabled,property_false);
         :a.a_reviewed_ind := 'N';
         :a.a_reviewed_user := Null;
         GO_BLOCK('a');
       END IF;
     END IF;
   END IF;
END;

0
 

Author Comment

by:geeta_m9
ID: 17131635
I'll try testing  the above code and get back to you.
0
 

Author Comment

by:geeta_m9
ID: 17131743
Jrb1, your suggestion works! Thank you! Also thanks for your help, kretzschmar and sathyagiri
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now