Home » Developer & Programmer » Forms » How to write condition in Duplicate record (Forms6i)
How to write condition in Duplicate record [message #407259] Tue, 09 June 2009 06:02 Go to next message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Hi all,

I want to get a duplicate record when the previous record item is 'MULTIPLE'.There are 10 text items .If the 1st feild is 'MULTIPLE' then the next record should be duplicated.This form i have attached to Oracle applications. I am starter in forms so, kindly explain me in detail. please reply me ASAP

Thanks in advance.
Re: How to write condition in Duplicate record [message #407320 is a reply to message #407259] Tue, 09 June 2009 10:14 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
dear try this on "key-next-item"


begin
select empno into :empno from emp where empno=:emp.empno;
message('Record Already Exist');
message('Record Already Exist');
raise form_trigger_failure;
exception when no_data_found then
null;
next_BLOCK;
end;

thanks
owais baba

Re: How to write condition in Duplicate record [message #407386 is a reply to message #407320] Wed, 10 June 2009 01:05 Go to previous messageGo to next message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Thanks for the response

but will it work for the entire record ?
Re: How to write condition in Duplicate record [message #407413 is a reply to message #407386] Wed, 10 June 2009 02:25 Go to previous messageGo to next message
ADNANTARIQ_85
Messages: 18
Registered: June 2009
Location: Faisalabad
Junior Member

MULTIPLE mean ???? not understand pls explain
Re: How to write condition in Duplicate record [message #407471 is a reply to message #407413] Wed, 10 June 2009 05:26 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
this condition will check duplicate entry from table

what u want pls explain completly either u would like check without saving data in table or like to check after saving data in table if u want to check duplication without saving record then condition will be different tell me also your table details
u got table parent or child and child table is tabular fields

pls explain briefly


baba
Re: How to write condition in Duplicate record [message #407488 is a reply to message #407471] Wed, 10 June 2009 05:52 Go to previous messageGo to next message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Thanks for the response

According to my requirement i have only one block with 10 field (columns). tabular (10rows). so for the 1st column which if i enter custom data then accordingly the next row has to get duplicate values else null...But it should not save it in DB.Its just for display.

For example :

Line_type account type company......are my columns
Multiple 000 1 1234
If i enter Multiple here then the next record has to be copied.

Multiple 000 1 1234 ...........

Hope this would get you clear idea about this.

Thanks in advance
Re: How to write condition in Duplicate record [message #407492 is a reply to message #407488] Wed, 10 June 2009 06:04 Go to previous messageGo to next message
ADNANTARIQ_85
Messages: 18
Registered: June 2009
Location: Faisalabad
Junior Member


on post text item trigger
you first count count number of record where you available 1 or 2 ...or 10 now you start loop


first_record;
loop
if current_column = loop_colums then
raise from_trigger_failure;
end if;
next_record

loop exit when (you total number of record which you find )


Understand?


M. Adnan Tariq

Re: How to write condition in Duplicate record [message #407503 is a reply to message #407492] Wed, 10 June 2009 06:15 Go to previous messageGo to next message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Sorry i din't understand. I just need to get a duplicate record when the first column is some custom value.can u take few columns and explain me how the code will be.
Re: How to write condition in Duplicate record [message #407507 is a reply to message #407259] Wed, 10 June 2009 06:23 Go to previous messageGo to next message
ADNANTARIQ_85
Messages: 18
Registered: June 2009
Location: Faisalabad
Junior Member

dear i use this

i just gave idea (logic) try to understand .... this idea
Re: How to write condition in Duplicate record [message #407536 is a reply to message #407503] Wed, 10 June 2009 07:27 Go to previous messageGo to next message
Littlefoot
Messages: 20897
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
One way (which can be improved) might look like this: create a WHEN-VALIDATE-ITEM trigger on the "line type" item as
:global.line_type := :line_type;

Next, create WHEN-NEW-RECORD-INSTANCE trigger on the same block as
if :global.line_type = 'Multiple' then
   duplicate_record;
end if;

This *might* work (note that you'll have to initialize the global variable first (also, consider using a parameter instead)); see what happens if you modify "line type" of a record that is NOT the last one. So ... it certainly requires some tweaking, but I hope you got the general idea.


By the way, what is the purpose of duplicating the same record? How do you plan only to display it and not save it into the database?

Perhaps you should explain the business requirement first - as you've said, you are a Forms newbie - maybe the whole process can be done differently (and more efficiently).
Re: How to write condition in Duplicate record [message #407656 is a reply to message #407536] Thu, 11 June 2009 00:11 Go to previous messageGo to next message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Thanks for all your responses
Re: How to write condition in Duplicate record [message #407662 is a reply to message #407656] Thu, 11 June 2009 00:21 Go to previous messageGo to next message
ADNANTARIQ_85
Messages: 18
Registered: June 2009
Location: Faisalabad
Junior Member

have you solution if yr problem ? mean you feel ok?
Re: How to write condition in Duplicate record [message #407665 is a reply to message #407259] Thu, 11 June 2009 00:25 Go to previous messageGo to next message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Yes I got the solution.Thank you. But my requirement got changed now...They don't want the duplicate record now. But still I have got a solution for this issue.As i am a newbie i have to go more ahead...

Thanks all
Re: How to write condition in Duplicate record [message #407673 is a reply to message #407259] Thu, 11 June 2009 01:04 Go to previous messageGo to next message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Hello all,

I am getting the duplicate record but can i write else part in the code. If yes what should i have to write. and even if i take other than MULTIPLE then the record has to be new record.
Sorry the same requirement again.....

Thanks in advance.
Re: How to write condition in Duplicate record [message #407692 is a reply to message #407259] Thu, 11 June 2009 02:12 Go to previous messageGo to next message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Hello,

Can any one tell me how to make a record null after changing the duplicate record is there at the new record.

Thanks
Re: How to write condition in Duplicate record [message #407706 is a reply to message #407692] Thu, 11 June 2009 03:38 Go to previous messageGo to next message
ADNANTARIQ_85
Messages: 18
Registered: June 2009
Location: Faisalabad
Junior Member

listen carefully

you need to crate a loop for this purpse

how ?

lets exprement

we use dept table which is normally available in scott schema we want -- when user insert new dept# If this is duplicate a show that duplication when go to next item or next record so we use "key next item trigger" and following code inset into trigger



-----------------------------------
declare
x number;
rec number;
begin
rec:= :DEPTNO;
x:=get_block_property('dept',CURRENT_RECORD);
first_record;
loop
x:=x-1;
exit when x=0;
if rec=:DEPTNO then
message('Dupplication');
message('Dupplication');
raise form_trigger_failure;
end if;
next_record;
end loop;
next_item;
end;
---------------------------------------------

now you chech your dupplication without saving i also attach fbm which is working correctlly

now you feel...............Don Y/N

M. Adnan Tariq
JK Groups ..FSD PAkistan
  • Attachment: SOL.fmb
    (Size: 48.00KB, Downloaded 117 times)
Re: How to write condition in Duplicate record [message #407717 is a reply to message #407259] Thu, 11 June 2009 04:52 Go to previous messageGo to next message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Can any one tell me how to initilize the global variable...which i have used here

:global.line_type := :line_type;


thanks
Re: How to write condition in Duplicate record [message #407730 is a reply to message #407320] Thu, 11 June 2009 05:49 Go to previous messageGo to next message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Please help me

I have to get 3 duplicate records. i have used this code.Its not working Kindly check for errors

I have written in when new record instance trigger

code :


Declare
x number;
Begin
x:=get_block_property('XXC_ACCOUNT_MAPPINGS',CURRENT_RECORD);
first_record;
loop
x:=x-3;
exit when x=0;
if :global.line_type = 'MULTIPLE' then
duplicate_record;
FND_MESSAGE.SET_NAME ('FND',' Duplicate Record ');
FND_MESSAGE.SHOW;
raise form_trigger_failure;
end if;
exit;
end loop;
next_record;
exception
when others then
/* Show an informational message */
FND_MESSAGE.SET_NAME ('FND','Other Error ');
FND_MESSAGE.SHOW;
End;
Re: How to write condition in Duplicate record [message #407849 is a reply to message #407730] Thu, 11 June 2009 22:37 Go to previous messageGo to next message
ADNANTARIQ_85
Messages: 18
Registered: June 2009
Location: Faisalabad
Junior Member

Dear me observe you have no idea about your requirement .me gave you a complete solution but you are unable to modify this code according to your requirement so please study about software requirement In software engineering and also study about PL/SQL deeply . sorry to say I thing me waste my time because your solution is pending .Dear in here people gave you logic not solution this is not primary school .......
Re: How to write condition in Duplicate record [message #407920 is a reply to message #407259] Fri, 12 June 2009 06:22 Go to previous message
aiyaz_ma
Messages: 56
Registered: May 2009
Location: Hyderabad
Member

Hello All,

I am extremly sorry for behaving like a school kid.As i am very new to Oracle and i have a month old in my company here. So, there is no such software requirement document i got here. My senior just give me the work to do and that too through mails.So, Kindly forgive me for my mistake. Sorry if i have wasted time of yours.

But kindly help me

Thanks and regards

M.A.AIYAZ
Previous Topic: when-button-pressed problem
Next Topic: Log in Window (Now want to run Window 1)
Goto Forum:
  


Current Time: Wed Dec 07 12:29:34 CST 2016

Total time taken to generate the page: 0.09372 seconds