Solved

Can't use go_item

Posted on 2010-09-15
15
3,625 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
ID: 33688446
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
ID: 33690639
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
ID: 33693772
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
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

Assisted Solution

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

Expert Comment

by:anumoses
ID: 33694006
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
ID: 33694032
 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
ID: 33694142
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
 
LVL 6

Expert Comment

by:anumoses
ID: 33694153
what is your forms version?
0
 

Author Comment

by:SFMelange
ID: 33694161
anumoses
10g
0
 
LVL 6

Expert Comment

by:anumoses
ID: 33694223
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
ID: 33694233
I ran in forms 10g. so it works for me
0
 
LVL 6

Expert Comment

by:anumoses
ID: 33694264
its do_key('enter');  - correct


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

Expert Comment

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

Accepted Solution

by:
flow01 earned 200 total points
ID: 33694734
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
ID: 33855860
I used the advice of the thee experts and came up with my own solution.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

809 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