Home » Developer & Programmer » Forms » Please help !!!!!!!!!!!
icon5.gif  Please help !!!!!!!!!!! [message #174416] Mon, 29 May 2006 04:01 Go to next message
Catty
Messages: 64
Registered: April 2006
Location: Poland
Member
Hello
I have trigger WHEN-VALIDATE-ITEM :

 if not( :ap2.KLASYFIKACJA IS NOT NULL ) then
  message( 'ON-VALIDATE-FIELD trigger failed on field - ' ||
 :system.trigger_field );
  raise form_trigger_failure;
end if;
declare
    cursor primary_cur is select 'x' from SL_AU_KLASYFIKACJI
        where KOD = :ap2.KLASYFIKACJA;
    primary_dummy  VARCHAR2(1);
begin
    if ( ( :ap2.KLASYFIKACJA is not null ) ) then
        open primary_cur;
        fetch primary_cur into primary_dummy;
        if ( not primary_cur%found ) then
           message
('Foreign key value does not currently exist in the primary key table.');
           close primary_cur;
           raise form_trigger_failure;
        end if;
        close primary_cur;
    end if;
end;
begin
  select pre_klasyfikacja into :global.dummy from au_przyrzady
   where nr_inw = :ap2.nr_inw
    and  grupa= :ap2.grupa;
  if :global.dummy=1 and :ap2.klasyfikacja<>1 then message
(' Niezgodnosc typow klasyfikacji klasy pierwszej');
raise form_trigger_failure;
elsif
  :global.dummy=2 and :ap2.klasyfikacja not in(1,2) then message
('   Niezgodnosc typow klasyfikacji klasy drugiej');
     raise form_trigger_failure;
    end if;
   exception when no_data_found then message (' Nie znaleziono danych');
end;


I have problem form point:
 
begin
  select pre_klasyfikacja into :global.dummy from au_przyrzady
   where nr_inw = :ap2.nr_inw
    and  grupa= :ap2.grupa;.........................


When I comipile my form I get message:
FRM- 40815 : Variable GLOBALM.DUMMY does not exist

What is happening!
I have declared this variable
I can't delete this part of code where dummy is, because I need it in my trigger.

Can anybody fix my code because I have no more ideas Sad
Re: Please help !!!!!!!!!!! [message #174418 is a reply to message #174416] Mon, 29 May 2006 04:06 Go to previous messageGo to next message
sanka_yanka
Messages: 184
Registered: October 2005
Location: Kolkata
Senior Member

One Idea may be flick
i.e. Set the :global.dummy field to null on the WHEN-NEW-FORM-INSTANCE trigger.
:global.dummy := null;

and use the GLOBAL variable to anywhere on the form.
I think it will solve ur porblem.

[Updated on: Mon, 29 May 2006 04:07]

Report message to a moderator

Re: Please help !!!!!!!!!!! [message #174424 is a reply to message #174418] Mon, 29 May 2006 04:12 Go to previous messageGo to next message
Catty
Messages: 64
Registered: April 2006
Location: Poland
Member
I have made like you told:
if not( :ap2.KLASYFIKACJA IS NOT NULL ) then
  message( 'ON-VALIDATE-FIELD trigger failed on field - ' ||
 :system.trigger_field );
  raise form_trigger_failure;
end if;
declare
    cursor primary_cur is select 'x' from SL_AU_KLASYFIKACJI
        where KOD = :ap2.KLASYFIKACJA;
    primary_dummy  VARCHAR2(1);
begin
    if ( ( :ap2.KLASYFIKACJA is not null ) ) then
        open primary_cur;
        fetch primary_cur into primary_dummy;
        if ( not primary_cur%found ) then
           message
('Foreign key value does not currently exist in the primary key table.');
           close primary_cur;
           raise form_trigger_failure;
        end if;
        close primary_cur;
    end if;
end;
begin
:global.dummy := null;
  select pre_klasyfikacja into :global.dummy from au_przyrzady
   where nr_inw = :ap2.nr_inw
    and  grupa= :ap2.grupa;
  if :global.dummy=1 and :ap2.klasyfikacja<>1 then message
(' Niezgodnosc typow klasyfikacji klasy pierwszej');
raise form_trigger_failure;
elsif
  :global.dummy=2 and :ap2.klasyfikacja not in(1,2) then message
('   Niezgodnosc typow klasyfikacji klasy drugiej');
     raise form_trigger_failure;
    end if;
   exception when no_data_found then message (' Nie znaleziono danych');
end;



but still that same error Sad
And moreover, my form close immediately Sad
Re: Please help !!!!!!!!!!! [message #174450 is a reply to message #174424] Mon, 29 May 2006 04:41 Go to previous messageGo to next message
Catty
Messages: 64
Registered: April 2006
Location: Poland
Member
sorry! little mistake
I have made WHEN-NEW-FORM-INSTANCE trigger.
:global.dummy := 0;

Variables nr_inw and grupa are numbers, but the problem is still there Sad My Form exits immediately.
Re: Please help !!!!!!!!!!! [message #174530 is a reply to message #174450] Mon, 29 May 2006 08:09 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Do your 'select' into a local variable and then use the 'copy' statement to put it into the global.

David
Re: Please help !!!!!!!!!!! [message #174679 is a reply to message #174530] Tue, 30 May 2006 05:05 Go to previous messageGo to next message
Catty
Messages: 64
Registered: April 2006
Location: Poland
Member
I have made something like this:
if not( :ap2.KLASYFIKACJA IS NOT NULL ) then
  message( 'ON-VALIDATE-FIELD trigger failed on field - ' ||
 :system.trigger_field );
  raise form_trigger_failure;
end if;
declare
    cursor primary_cur is select 'x' from SL_AU_KLASYFIKACJI
        where KOD = :ap2.KLASYFIKACJA;
    primary_dummy  VARCHAR2(1);
begin
    if ( ( :ap2.KLASYFIKACJA is not null ) ) then
        open primary_cur;
        fetch primary_cur into primary_dummy;
        if ( not primary_cur%found ) then
           message
('Foreign key value does not currently exist in the primary key table.');
           close primary_cur;
           raise form_trigger_failure;
        end if;
        close primary_cur;
    end if;
end;
[COLOR=red]declare 
	second_dummy VARCHAR2(1); 
begin
  select pre_klasyfikacja into second_dummy from au_przyrzady
   where nr_inw = :ap2.nr_inw
    and  grupa= :ap2.grupa;
    :global.dummy:=second_dummy;[/COLOR]
  if :global.dummy=1 and :ap2.klasyfikacja<>1 then message
(' Niezgodnosc typow klasyfikacji klasy pierwszej');
raise form_trigger_failure;
elsif
  :global.dummy=2 and :ap2.klasyfikacja not in(1,2) then message
('   Niezgodnosc typow klasyfikacji klasy drugiej');
     raise form_trigger_failure;
    end if;
   exception when no_data_found then message (' Nie znaleziono danych');
end;

.....but my form is closing at once ! Sad
Re: Please help !!!!!!!!!!! [message #174771 is a reply to message #174679] Tue, 30 May 2006 08:52 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I said to use the 'copy' command not an assignment.

What version of forms are you using? Are you doing a Ctrl-Shft-K (Compile ALl) and then a Ctrl-T (Generate)? If you are just using the Ctrl-K (Incremental Compile) your forms session is probably becoming internally unstable.

David
Re: Please help !!!!!!!!!!! [message #174779 is a reply to message #174679] Tue, 30 May 2006 09:03 Go to previous messageGo to next message
karuparamb
Messages: 13
Registered: December 2005
Location: Jeddah
Junior Member

use this -> :global.dummy := null;
inside of ON-LOGON Trigger, instead of WHEN-NEW-FORM-INSTANCE

Best Regards.

Abdul Aziz. K. P
Re: Please help !!!!!!!!!!! [message #174781 is a reply to message #174679] Tue, 30 May 2006 09:10 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Also consider doing a Default_Value(NULL, 'Global.Dummy') before doing your IF test.

David
Previous Topic: Problem calling graph(Chart) thru forms menu
Next Topic: How To - Adding a link to a custom form
Goto Forum:
  


Current Time: Fri Sep 20 10:35:43 CDT 2024