to check values in multirecord [message #128853] |
Wed, 20 July 2005 23:13 |
manjuvasu
Messages: 22 Registered: May 2005
|
Junior Member |
|
|
hello,
this is in forms. i have created a multirecord.while entering the values i have to check whether the previous record is same or not.how to do it.
|
|
|
|
|
Re: to check values in multirecord [message #129089 is a reply to message #129072] |
Thu, 21 July 2005 23:06 |
manjuvasu
Messages: 22 Registered: May 2005
|
Junior Member |
|
|
hi,
this is not a database record.just while inputting the values like say, i am entering ename in multirecord-
ename
------
antony
bharat
catherine
antony ------>this name should not be repeated.here i have to check that the name is already entered.
how to ?
|
|
|
|
Re: to check values in multirecord [message #129270 is a reply to message #129269] |
Sat, 23 July 2005 00:33 |
pradeep_davis
Messages: 14 Registered: July 2005
|
Junior Member |
|
|
call this procedure when_create_record trigger
PROCEDURE dup_record
(blk_name VARCHAR2,
col1 VARCHAR2,
col2 VARCHAR2 DEFAULT NULL,
col3 VARCHAR2 DEFAULT NULL,
col4 VARCHAR2 DEFAULT NULL,
col5 VARCHAR2 DEFAULT NULL,
lbl_text VARCHAR2 DEFAULT NULL)
IS
rg_id recordgroup;
rg_name VARCHAR2(20) := 'Dupval';
rg_col groupcolumn;
error NUMBER;
reco_offset NUMBER;
col_val1 VARCHAR2(200);
col_val2 VARCHAR2(200);
colval VARCHAR2(1000);
len NUMBER;
BEGIN
rg_id := Find_group(rg_name);
IF NOT Id_null(rg_id) THEN
Delete_group(rg_id);
END IF;
rg_id := Create_group(rg_name);
rg_col := Add_group_column(rg_id,
'Columnchar',
char_column,
200); --if :system.form_status ='CHANGED' THEN
Go_block(blk_name);
IF form_success THEN
last_record;
reco_offset := :system.cursor_record;
first_record;
FOR i IN 1.. reco_offset LOOP
Go_record(i);
Add_group_row(rg_id,
end_of_group);
colval := '';
IF (col1 IS NOT NULL ) THEN
colval := colval || Name_in(blk_name || '.' || col1);
END IF;
IF (col2 IS NOT NULL ) THEN
colval := colval || Name_in(blk_name || '.' || col2);
END IF;
IF (col3 IS NOT NULL ) THEN
colval := colval || Name_in(blk_name || '.' || col3);
END IF;
IF (col4 IS NOT NULL ) THEN
colval := colval || Name_in(blk_name || '.' || col4);
END IF;
IF (col5 IS NOT NULL ) THEN
colval := colval || Name_in(blk_name || '.' || col5);
END IF;
Set_group_char_cell(rg_col,
i,
colval);
END LOOP;
len := Get_group_row_count(rg_id);
FOR i IN 1.. len LOOP
col_val1 := Get_group_char_cell(rg_col,
i);
FOR j IN (i + 1).. len LOOP
col_val2 := Get_group_char_cell(rg_col,
j);
IF col_val1 = col_val2 THEN
IF (lbl_text IS NULL ) THEN
error := Happ_msgs('E061',
'MREC',
blk_name);
ELSE
error := Happ_msgs('E061',
'MREC',
lbl_text);
END IF;
Go_record(j);
--GO_RECORD(RECO_OFFSET);
fail;
END IF;
END LOOP;
END LOOP;
Go_record(reco_offset);
END IF;
END;
Upd-mod: Reformat code
[Updated on: Thu, 13 October 2005 01:43] by Moderator Report message to a moderator
|
|
|
|
|
Re: to check values in multirecord [message #130120 is a reply to message #130110] |
Thu, 28 July 2005 05:00 |
manjuvasu
Messages: 22 Registered: May 2005
|
Junior Member |
|
|
hi,
i have two items t1 and t2 as multirecord.in key-next-item trigger of t1,the following codings has been written.
declare
a number;
s varchar2(20);
c varchar2(20);
begin
a := get_block_property('blkname',current_record);
if a=1 then
go_item('blkname.t2');
else
s := :system.current_value;
go_block('blkname');
first_record;
for i in 1..a-1 loop
if s = :blkname.t1 then
message('Duplicate');
c := get_message;
end if;
next_record;
end loop;
last_record;
go_item('blkname.t2');
end if;
if c = 'Duplicate' then
go_item('blkname.t1');
end if;
end;
check it out and reply me.
Upd-mod: Add code tags
[Updated on: Thu, 13 October 2005 01:44] by Moderator Report message to a moderator
|
|
|