Solved

Can't use go_item

Posted on 2010-09-15
15
3,466 Views
Last Modified: 2012-06-27
In a when-validate-item (w-v-i) trigger :item = 'Y' I want the cursor to move to a previous item on the  canvas. I cannot use a go_item in a w-v-i trigger. I tried a key-next-item with a go_item and it didn't GO.

K-N-I code
if :suspected_of_drug = 'Y'
   and :criminal_activity_code is null
   then
   go_item('incident_offenses.Criminal_Activity_Code');
end if;
0
Comment
Question by:SFMelange
15 Comments
 
LVL 4

Assisted Solution

by:leewv1
leewv1 earned 150 total points
Comment Utility
You can't use navigation commands (GO_BLOCK, GO_ITEM) in when-validate triggers.  

Here's a similar issue:  http://www.experts-exchange.com/Database/Oracle/Q_12041279.html
0
 
LVL 6

Expert Comment

by:anumoses
Comment Utility
key-next-item trigger use this do_key('enter');

key-enter trigger -
if :suspected_of_drug = 'Y'
   and :criminal_activity_code is null
   then
   go_item('incident_offenses.Criminal_Activity_Code');
end if;

Try this
0
 

Author Comment

by:SFMelange
Comment Utility
anumoses, I tried your suggestion but received an error - am I misunderstanding something?

1. created a key-next-itme with do_key('key-enter');
2. created key-enter trigger
3. got error on:
key-enter trigger -
    if :suspected_of_drug = 'Y'
    and :criminal_activity_code is null
    then go_item('incident_offenses.Criminal_activity_code');
   end if;
Error 103 at line 1 column 4
encountered the symbol "." when excepting one of the following:  :=.(@%;
This error is flagging the first hyphen on the first line key-enter trigger
0
 
LVL 6

Assisted Solution

by:anumoses
anumoses earned 150 total points
Comment Utility
Are these triggers at item level? I mean where are you writing these triggers?
0
 
LVL 6

Expert Comment

by:anumoses
Comment Utility
You can also use previous_item; in the key-enter trigger
and keep the code for key-next-item as it is with do_key('enter');
0
 
LVL 6

Expert Comment

by:anumoses
Comment Utility
 if (:suspected_of_drug = 'Y' and :criminal_activity_code is null ) then
    go_item('incident_offenses.Criminal_activity_code');
   end if;
OR
  if (:suspected_of_drug = 'Y' and :criminal_activity_code is null ) then
    previous_item;
   end if;

This is for key-enter trigger

0
 

Author Comment

by:SFMelange
Comment Utility
anumoses,
Yes, these triggers are at item level.
Why am I getting an error on "the first line" which is auto populated "key-enter trigger -"
As for the "key-next-item "do_key('enter'); "  IS IT ('enter') or is it ('key-enter') ?
Thanks for the help.
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 6

Expert Comment

by:anumoses
Comment Utility
what is your forms version?
0
 

Author Comment

by:SFMelange
Comment Utility
anumoses
10g
0
 
LVL 6

Expert Comment

by:anumoses
Comment Utility
create a test .fmb

three fields.

In the second field add the code
key-enter trigger  and key-next-item trigger
key-enter trigger - code is previous_item;
key-next-item - code is do_key('enter');
Try and run this.  Here I cannot upload fmb.
0
 
LVL 6

Expert Comment

by:anumoses
Comment Utility
I ran in forms 10g. so it works for me
0
 
LVL 6

Expert Comment

by:anumoses
Comment Utility
its do_key('enter');  - correct


not do_key('key-enter'); in - correct
0
 
LVL 6

Expert Comment

by:anumoses
Comment Utility
Try this also
Do_Key('PREVIOUS_ITEM');  in w-v-i
0
 
LVL 20

Accepted Solution

by:
flow01 earned 200 total points
Comment Utility
to fix your error message try
create  a key-next-item with

do_key(('key-enter'); --
-- once the key-enter is executed  evaluate the new status
    if :suspected_of_drug = 'Y'
    and :criminal_activity_code is null
    then go_item('incident_offenses.Criminal_activity_code');
   end if;

--  but I suspect this is not what you want in the end:
using this method in stead of the  when-validate-item you will have to take such action  for every key or mouse action that causes the suspected_of_drug item to leave
(previous-item, next_block, previous block , commit , .. etc)


-- i would use a timer
when-validate-item >>
message('validate item',acknowledge);
if :suspected_of_drug = 'Y'  AND :criminal_activity_code IS NULL THEN
      DECLARE timer_id Timer;  
      BEGIN timer_id := CREATE_TIMER('go_criminal_activity_code', 5, NO_REPEAT);  -- create a  timer firing after 5mseconds
      END;
END IF;
-- the item is marked as valid , but after that the timer fires

when-timer-expired >>  (on form level)
IF GET_APPLICATION_PROPERTY(TIMER_NAME) = 'GO_CRIMINAL_ACTIVITY_CODE' THEN
  go_item('criminal_activity_code');
END IF;

-- to prevent leaving the record by for example next_block or commit
when-validate-record >>
message('validate record',acknowledge);
if :suspected_of_drug = 'Y'  AND :criminal_activity_code IS NULL THEN
      DECLARE timer_id Timer;  
      BEGIN timer_id := CREATE_TIMER('go_criminal_activity_code', 5, NO_REPEAT);  -- create a  timer firing after 5mseconds
      END;
      raise form_trigger_failure; -- don't leave the record until the condition is satisfied
END IF;


0
 

Author Closing Comment

by:SFMelange
Comment Utility
I used the advice of the thee experts and came up with my own solution.
0

Featured Post

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.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
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.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

728 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

10 Experts available now in Live!

Get 1:1 Help Now