Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can't use go_item

Posted on 2010-09-15
15
Medium Priority
?
3,930 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
15 Comments
 
LVL 4

Assisted Solution

by:leewv1
leewv1 earned 600 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Assisted Solution

by:anumoses
anumoses earned 600 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 800 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
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…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

650 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