location and save button [message #552297] |
Wed, 25 April 2012 00:00 |
|
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 #552358 is a reply to message #552346] |
Wed, 25 April 2012 04:04 |
cookiemonster
Messages: 13963 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 #552384 is a reply to message #552370] |
Wed, 25 April 2012 06:34 |
cookiemonster
Messages: 13963 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 #552395 is a reply to message #552393] |
Wed, 25 April 2012 08:10 |
|
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..
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 #552415 is a reply to message #552397] |
Wed, 25 April 2012 10:45 |
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 |
|
Littlefoot
Messages: 21823 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 #552541 is a reply to message #552367] |
Thu, 26 April 2012 07:59 |
|
"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 #552547 is a reply to message #552543] |
Thu, 26 April 2012 08:09 |
|
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 |
cookiemonster
Messages: 13963 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 |
|
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.
|
|
|
|
|