Home » Developer & Programmer » Forms » cannot pass value from one form to another although using global variable!! (oracle 10g , win 8.1 x64)
cannot pass value from one form to another although using global variable!! [message #673994] Thu, 20 December 2018 14:15 Go to next message
Oraclinho
Messages: 9
Registered: December 2018
Junior Member
I have 2 forms one for prices of types and the other for the types. I want to pass the price of one piece of that type from the 1st form to the second form to calculate the total price by multiplying the price by the number of pieces of that type. I want to calculate the total price when I add the number of pieces directly to the price display item.

I added pre_text_item trigger to the price item in the 1st form and here is its code:
:global.price_new := :price_new;
in the other hand, I added when_validate_item trigger to the number of pieces item and here is its code:
declare
	no_types number;
begin

	select type_num
	into no_types
	from types, prices
	where types.type_name = prices.type_name;

        if no_types is not null then
	   :types.price := :global.price_new * no_types;
        else
	   message('There is no price for that type. Please add a price for it in price page.');
	   message('There is no price for that type. Please add a price for it in price page.');
        end if;
end;
I wanna to show the total price in price item in the 2nd form when I press tab to navigate from number item to price item, but I the mouse cursor don't move and stuck in number item with that error:

FRM-40735: when_validate_item trigger raised unhandled exception ORA-01403

any help to solve that error and perform that action in the form ??


[EDITED by LF: applied [code] tags]

[Updated on: Fri, 21 December 2018 01:10] by Moderator

Report message to a moderator

Re: cannot pass value from one form to another although using global variable!! [message #673995 is a reply to message #673994] Fri, 21 December 2018 01:13 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
SELECT is what returned NO-DATA-FOUND (ORA-01403). Why? Because no rows in those tables satisfy WHERE condition, which means that you should fix that.

Also, shouldn't you include a reference to some form item? There's a danger of getting TOO-MANY-ROWS, the way it is written now (i.e. just the opposite of of NO-DATA-FOUND).

As we don't have your data, you'll have to run that query and see what's going on.
Re: cannot pass value from one form to another although using global variable!! [message #674000 is a reply to message #673995] Fri, 21 December 2018 03:35 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Also - why are you using globals to pass values between forms instead of parameters? That's why parameters exist after all.
Re: cannot pass value from one form to another although using global variable!! [message #674655 is a reply to message #674000] Thu, 07 February 2019 07:22 Go to previous message
Neveen2019
Messages: 13
Registered: February 2019
Junior Member
Hi
Sorry, but if i were you i would redesign my database table to an invoice form which will include one form with item_no, price, quantity.
No need for a Global. If it is necessary to follow this current design then, you must involve the exception section with any select statement.
Besides, it is strongly recommended to destroy 'Global variables' at the moment you don't need anymore.
Previous Topic: Form Maximize Issue in Forms 10g
Next Topic: Canvas not showing
Goto Forum:
  


Current Time: Fri Mar 29 01:07:56 CDT 2024