Home » Developer & Programmer » Forms » WNRI
WNRI [message #641585] |
Tue, 18 August 2015 09:41 |
|
palpali
Messages: 138 Registered: December 2014 Location: India
|
Senior Member |
|
|
Hallo
I have master-detail block. and when i navigate my cursor in master_block (ID field) then change the records in the detail block, but when I move to the other ID then it prompts message:
(Do you want to save the chagens you have made? Yes/No/Cancel), though i don't have done anything in the detail block.
Can anyone please help me, what could be the reason?
and also, is there any other options to do instead of duplicate_record;
actually I have in my detail block, WNRI, as:
if :system.block_status = 'QUERY' then
if :system.record_status = 'NEW' then
duplicate_record;
set_block_property('blk1', INSERT_ALLOWED, PROPERTY_TRUE);
:blk1.text := null;
set_record_property (:system.trigger_record, :system.trigger_block, status, new_status);
end if;
end if;
and when i navigate the records with key-down arrow, it did not go to the new row, when it is in last record.
Help please
regards,
|
|
|
|
Re: WNRI [message #641587 is a reply to message #641585] |
Tue, 18 August 2015 09:48 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Of course you've done something in the detail block - you've run duplicate_record and then set an item to null.
That's data that the form assumes needs to be saved.
This is the downside of defaulting in data as soon as the user enters a new record.
|
|
|
|
|
|
|
|
|
|
Re: WNRI [message #641612 is a reply to message #641611] |
Wed, 19 August 2015 03:16 |
|
palpali
Messages: 138 Registered: December 2014 Location: India
|
Senior Member |
|
|
Hallo LF,
Well,. I changed my code as per your Suggestion.
But the Problem is same. sry
I mean, it works fine when i press F7 first time, and Input the required field but when i press F7 2nd time then, it just insert blank row, below the current record.
I pressed first F7 then, Record --> Duplicate, it duplicates the above record, and again when i press F7 then it insert the blank row again but, when i go through Record --> Duoplicate then i duplicates all the record agin as above it.
The same function, I am trying to do with F7 key.
Any Suggestion please.
Regards
|
|
|
|
|
|
Re: WNRI [message #641616 is a reply to message #641615] |
Wed, 19 August 2015 04:23 |
|
palpali
Messages: 138 Registered: December 2014 Location: India
|
Senior Member |
|
|
Hallo LF
Thank you very very much for your great support and great help. It works now, what i was trying to do for.
well, i have dropped my KEY-F7 trigger and instead of that created KEY-CREREC trigger as:
create_record;
duplicate_record;
:blk1.text1 := null;
But, now i am having another problem, in my detail block, user are allowed to input just the one field, i.e. text1, and sometimes the value is very long text, and i would like to have that user can just click and select the above value of text1 field and paste into new row and just need to change some.
would it be possible to do so?
i do have, WNRI trigger in my detail block as:
if :system.block_status = 'QUERY' then
if :system.record_status = 'NEW' then
set_block_property('BLK1', INSERT_ALLOWED, PROPERTY_TRUE);
create_record;
duplicate_record;
:blk1.text1 := null;
set_record_property (:system.trigger_record, :system.trigger_block, status, new_status);
end if;
end if;
but it did not do that. Any suggestion please?
Regards.
|
|
|
Re: WNRI [message #641617 is a reply to message #641616] |
Wed, 19 August 2015 04:35 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Are you saying copy and paste didn't work or do you have some code you're not showing us to automatically copy the value?
|
|
|
|
Re: WNRI [message #641621 is a reply to message #641618] |
Wed, 19 August 2015 05:54 |
|
palpali
Messages: 138 Registered: December 2014 Location: India
|
Senior Member |
|
|
Hallo CM, LF,
Sry, no i don't have any other code to copy the value automatically, except that duplicate_record do that for me. but,
I think i will consider your @LF Suggestion, because, before, i thought that to set that field text1 null, but now i am considering your Suggestion, not Setting that field to null, instead of, it duplicates the all record and the user should Change the text1 field as per Need. Besides, I have also WVI Trigger at text1 field to check if the entered value same is.
Anyway, thanking you all for your great Suggestion and Help.
Regards,
|
|
|
Re: WNRI [message #641666 is a reply to message #641621] |
Thu, 20 August 2015 03:04 |
|
palpali
Messages: 138 Registered: December 2014 Location: India
|
Senior Member |
|
|
Hallo
As I have done as per my previous post, that duplicating all the records as above, but getting while inserting data.
I got the error:
"FRM-40735: ON-INSERT Trigger raised unhandled exception ORA-00001"
On-Insert Trigger :
insert into table1 (id, pid, text) values (120, 10, 'product');
and also i do have WVI Trigger at text field, which checks that if there are same product Name in the block is, and throw when saving the records. But, in my case, id did not Show any message or it did not throw WVI Trigger but just give the above error.
WNI trigger:
declare
rec number
begin
select Count(*) into rec from table 1
where id = :blk1.id
and pid = :blk1.pid
and text= :blk1.text;
if rec > 0 then
message('The product is same, please enter new Name !');
raise form_failure_trigger;
end if;
end;
Any suggestion please?
Regards,
|
|
|
|
|
Re: WNRI [message #641670 is a reply to message #641669] |
Thu, 20 August 2015 03:13 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
fehler?
1) Why have you got :ctl_blk.id in there rather than :blk1.id?
2) You should probably check that :ctl_blk.id and :blk1.id actually match
3) Why have an on-insert at all?
4) I'd check that the WNVI is actually firing - stick a message in the start of it.
|
|
|
|
Re: WNRI [message #641678 is a reply to message #641671] |
Thu, 20 August 2015 03:42 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You should still have id in blk1 and it should have the same value as the control block. So there's no good reason not to have :blk1.id in the on-insert.
You still need to check 2 and 4.
|
|
|
Re: WNRI [message #641682 is a reply to message #641678] |
Thu, 20 August 2015 03:56 |
|
palpali
Messages: 138 Registered: December 2014 Location: India
|
Senior Member |
|
|
I mean to say is, yes, I do have id in blk1 too, but i am just displaying pid and text in blk1 and id in control_blk, and yes the id have the same value as in ctrl_blk.id.
Well, in my case, in Detail block, when i press key F7, it will insert a new row and duplicate the values as above it and user Need to just Change the text field, it should not be the same, thats why i use WVI Trigger, but it did not fire, and just give this error.
that means, when i insert new row and give new product Name then, it should update table1 with These 3 values, the id and pid will be same and product Name will be different.
|
|
|
Re: WNRI [message #641686 is a reply to message #641682] |
Thu, 20 August 2015 04:26 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Have you specifically checked that the WVI is not firing or are you just assuming it's not because you don't get the Product is the same message?
|
|
|
|
Re: WNRI [message #641689 is a reply to message #641688] |
Thu, 20 August 2015 04:44 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Not entirely sure. Whether WVI fires is basically down to the item_is_valid property. If it's false then WVI should fire before you can save.
So put messages in to display that property of the text item before and after the call to duplicate record.
|
|
|
|
|
|
|
Re: WNRI /WVR [message #641700 is a reply to message #641699] |
Thu, 20 August 2015 08:24 |
|
palpali
Messages: 138 Registered: December 2014 Location: India
|
Senior Member |
|
|
Hallo CM,
Thank you very much for your Suggestion.
I put the following code in key-crerec Trigger:
begin
create_record;
if get_item_property(:System.cursor_item, item_is_valid) = 'FALSE' then
message('Input item is invalid');
raise form_trigger_failure;
end if;
duplicate_record;
if get_item_property(:System.cursor_item, item_is_valid) = 'FALSE' then
message('Input item is invalid');
raise form_trigger_failure;
end if;
go_item('blk1.text');
end;
so, now it throw the message when i insert a new row (F7), and then when i click to save record it gives me still the same error
Quote:"FRM-40508: ORACLE error unable to insert record" and when i display error then:
SQL statement in error: INSERT into table1 (id, pid, text) values (:1, :2, :3)
Error: ORA-00001: unique constraint(db.blk1_pk) violated
Any suggestion please?
thankx
|
|
|
|
Re: WNRI /WVR [message #641702 is a reply to message #641700] |
Thu, 20 August 2015 08:34 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
palpali wrote on Thu, 20 August 2015 14:24Any suggestion please?
Yes. Tell us what the value of item_is_valid actually is before and after the call to duplicate record like I asked.
We're in the process of determining the cause of the issue here, which has to be done before we can fix it, so there's no point repeatedly telling us you're getting ORA-00001.
|
|
|
Re: WNRI /WVR [message #641703 is a reply to message #641702] |
Thu, 20 August 2015 08:36 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Also having the same message text before and after is pointless. You need to be able to tell from the message whether it's displaying the property before or after duplicate record.
|
|
|
Re: WNRI /WVR [message #641704 is a reply to message #641703] |
Thu, 20 August 2015 08:38 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Also specify the actual item you're interested in in the call to get_item_property. :System.cursor_item should be correct but why take the risk that it isn't.
|
|
|
|
Re: WNRI /WVR [message #641708 is a reply to message #641702] |
Thu, 20 August 2015 08:48 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
As I said previously:
cookiemonster wrote on Thu, 20 August 2015 14:34We're in the process of determining the cause of the issue here, which has to be done before we can fix it
I didn't expect the WVI to fire. We currently have no idea why it isn't firing. Adding some messages to get the item status isn't going to magically fix it. Hopefully though it'll give us enough information to determine the cause of the problem.
But that's only going to happen if you actually give us the information we ask for
Seriously - we're doing basic debugging here, which is a basic programming skill which you need to wrap your head around fast.
|
|
|
Re: WNRI /WVR [message #641722 is a reply to message #641708] |
Fri, 21 August 2015 00:48 |
|
palpali
Messages: 138 Registered: December 2014 Location: India
|
Senior Member |
|
|
Hallo CM,
Well, i did Change some code in my key-crerec Trigger after your Feedback to check the return value of item_is_vlid property,
declare
var varchar2(10);
begin
create_record;
var := get_item_property('blk1.text1', item_is_valid);
message ('Value is ' || var);
duplicate_record;
var := get_item_property('blk1.text1', item_is_valid);
message ('Value is ' || var);
go_item('blk1.text1');
end;
so, after doing this,
when i press the F7 key then it inserts the new rows with duplicating values from above and give message, value is FALSE, (BEFORE DUPLICATE_RECORD)
and AFTER DUPLICATE_RECORD : it gives message, value is TRUE.
But did not fire the trigger.
Any feedback?
Thanking you alot.
Regards,
|
|
|
Goto Forum:
Current Time: Sun Feb 02 07:43:55 CST 2025
|