Home » Developer & Programmer » Forms » location and save button (oracle forms 10g)
location and save button [message #552297] Wed, 25 April 2012 00:00 Go to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
hi all...

i have a master-detail form on which i have 2 buttons.
save button and another location button in detail.on location button i am calling a form and updating location of the material entered in detail(tabular).
the thing is my form should not get save without updating location for each record entered in detail(tabular).if user try to save form without updating or pressing
location button it should give message PLEASE UPDATE YOUR LOCATION..

thank really lot in advance for your expert help...thank you...

[Updated on: Wed, 25 April 2012 00:10]

Report message to a moderator

Re: location and save button [message #552337 is a reply to message #552297] Wed, 25 April 2012 03:21 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why not just make the location field required?
Re: location and save button [message #552346 is a reply to message #552337] Wed, 25 April 2012 03:38 Go to previous messageGo to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
location is not a field sir,its a button in detail form(tabular).
Re: location and save button [message #552358 is a reply to message #552346] Wed, 25 April 2012 04:04 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Only way I can think of is to have the button code set an item in the form to a certain value.
Then check the item has the correct value in a when-validate-record trigger.
Re: location and save button [message #552367 is a reply to message #552358] Wed, 25 April 2012 04:45 Go to previous messageGo to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
declare

b_count number;
begin
select count(*) into b_count from loc_abha where
mat_code = :ship_dtl.mat_code;
if b_count = 0 then
message('please update your location');
message('please update your location');
raise form_trigger_failure;
else

gen_alert;

i write this on when button press...
still is directly executing my gen_alert to commit form.
Re: location and save button [message #552368 is a reply to message #552367] Wed, 25 April 2012 04:48 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Then the count isn't returning 0 is it?
Re: location and save button [message #552370 is a reply to message #552368] Wed, 25 April 2012 05:10 Go to previous messageGo to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
yes sir ..it has records already..
Re: location and save button [message #552384 is a reply to message #552370] Wed, 25 April 2012 06:34 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
OK - so what do you expect me to do?

You've given me no real information on what the button does.
You've not told me what tables and data you have.
You've not told me what data should or should not be populated when the button is pressed or when the user tries to save the form.

So how can I tell you how to correct your code?
Re: location and save button [message #552388 is a reply to message #552384] Wed, 25 April 2012 07:16 Go to previous messageGo to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
sir if u dont mind shall i provide u with a screen shot of my form ?
Re: location and save button [message #552393 is a reply to message #552388] Wed, 25 April 2012 07:57 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
It might help
Re: location and save button [message #552395 is a reply to message #552393] Wed, 25 April 2012 08:10 Go to previous messageGo to next message
furqan
Messages: 115
Registered: January 2012
Location: Hyderabad
Senior Member
you can see save button..and in tabular location button.
what exactly want to do is when user enter master-detail information and try to save form without pressing location but he should not be able to.on location button iam calling another form with item storage details such as row,shelf etc..etc..


/forum/fa/10097/0/



CM: inserted image into message body

[Updated on: Wed, 25 April 2012 08:14] by Moderator

Report message to a moderator

Re: location and save button [message #552397 is a reply to message #552395] Wed, 25 April 2012 08:15 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
That doesn't in anyway explain what the code you posted above is trying to do.
Re: location and save button [message #552415 is a reply to message #552397] Wed, 25 April 2012 10:45 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
pls mr@furqan explain properly. You meant to say untill unless location should be selected in detail block data should not be saved in table????

first of fall where ur's all buttons r residing in control block if not thn keep all btns in control block its better make one toolbar canvas and keep buttons there 2ndly i couldn't get your question.


regards
baba

[Updated on: Wed, 25 April 2012 11:00]

Report message to a moderator

Re: location and save button [message #552434 is a reply to message #552415] Wed, 25 April 2012 15:07 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
@furqan: could you also post screenshot of a form that opens when you push the "Location" button?

Why? Perhaps you could include location details into this form (the one you already posted). How? By creating a stacked canvas and putting several rightmost items (Assett No, Serial No, Transaction Note) onto it, as well as all items that belong to "location" (of course, unless there are far too many of them). A good thing about it is that stacked canvas has a horizontal scrollbar, so - basically, you can create a very wide stacked canvas (while only a small part of it is visible at the moment).




@owais_baba, please, put some effort and try to type full words. Many letters are missing in your message and it is difficult to read it.
Re: location and save button [message #552442 is a reply to message #552434] Wed, 25 April 2012 17:22 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
sorry Mr.@littlefoot next time i will try to type full words.

For @Furqan here is a fmb file for simple example for stacked canvas






regards
baba
Re: location and save button [message #552443 is a reply to message #552442] Wed, 25 April 2012 17:25 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
why uploadin fmb file
Re: location and save button [message #552445 is a reply to message #552443] Wed, 25 April 2012 17:41 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
sorry dear i am trying to upload FMB file here shown uploaded but i dont know why not uploading i think due to some technical reason ok next time i will try to upload




regards
baba

[Updated on: Wed, 25 April 2012 17:45]

Report message to a moderator

Re: location and save button [message #552541 is a reply to message #552367] Thu, 26 April 2012 07:59 Go to previous messageGo to next message
chandan.rattan
Messages: 84
Registered: December 2008
Location: India
Member

"declare

b_count number;
begin
select count(*) into b_count from loc_abha where
mat_code = :ship_dtl.mat_code;
if b_count = 0 then
message('please update your location');
message('please update your location');
raise form_trigger_failure;
else

gen_alert;
"

Hey try to use the below code and check.I think if you use SQL%NOTFOUND, then it should work.

declare

b_count number;
begin
select count(*) into b_count from loc_abha where
mat_code = :ship_dtl.mat_code;
if SQL%NOTFOUND then
message('please update your location');
message('please update your location');
raise form_trigger_failure;
else

gen_alert;
Re: location and save button [message #552543 is a reply to message #552541] Thu, 26 April 2012 08:04 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
You think?

A select count(*) (or select any aggregate function) without a group by, will always return 1 row.
So a SQL%NOTFOUND following such a query will never, ever be true.

In addtion, can you please read and follow How to use [code] tags and make your code easier to read?
Re: location and save button [message #552547 is a reply to message #552543] Thu, 26 April 2012 08:09 Go to previous messageGo to next message
chandan.rattan
Messages: 84
Registered: December 2008
Location: India
Member

Yes you are correct.I missed one part.Again pasting the code below.


declare
b_count number;
begin
select 1 into b_count from loc_abha where 
mat_code = :ship_dtl.mat_code;
if SQL%NOTFOUND then 
message('please update your location');
message('please update your location');
raise form_trigger_failure;
else

gen_alert;
Re: location and save button [message #552550 is a reply to message #552547] Thu, 26 April 2012 08:15 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
It's worrying how little you understand about how select works. That won't work either. 2 problems:
1) If there are no rows matching the where clause that'll cause a no_data_found exception. So the code will jump to the exception handler if there is one and the IF statement will never run. So in the only circumstance that SQL%NOTFOUND could be true it's not checked.
2) If there is more than 1 row matching the where clause that'll cause a too_many_rows exception and again the code will jump to the exception handler if there is one. Again the IF statement will not be executed.

The problem was that the OP was expecting a count of 0 and not getting it. None of your suggestions do anything to solve that problem.
In fact no-one here can suggest a solution to that until the OP tells how data is inserted into that table and how that relates to what is going on in the rest of the form.
Re: location and save button [message #552557 is a reply to message #552550] Thu, 26 April 2012 08:47 Go to previous messageGo to next message
chandan.rattan
Messages: 84
Registered: December 2008
Location: India
Member

Sorry @CokieMonster....My Sugestion was give OP idea about using %NOTFOUND instead of using directing values in condition.So i was caring much about the exceptions. I will take care next time and will try to give proper code with all possibilities.

Letc wait for OP to give full detail about code.
Re: location and save button [message #552560 is a reply to message #552557] Thu, 26 April 2012 08:57 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
SQL%NOTFOUND against a select into is completely pointless.
Re: location and save button [message #552566 is a reply to message #552560] Thu, 26 April 2012 09:58 Go to previous message
chandan.rattan
Messages: 84
Registered: December 2008
Location: India
Member

Yes You are rite.
Previous Topic: Positioning Canvas at Runtime
Next Topic: WebUtil File_Open_Dialog with multiple file types
Goto Forum:
  


Current Time: Fri Jul 05 22:38:29 CDT 2024