Question : Record Groups , How ?

HI,

I have a product code column  in a detail master(multi records) in which i have to  check the duplication.
I have created a Record Group to check for duplication . There seems to be
some problem. Please have a look at the code and reply.

Thanks

HI, I have added createGroup for creating the RG.
and made changes to code as varchar2(64), still error remains.


DECLARE
rg_name varchar(30) := 'my_group';
rg_id RecordGroup;
gc_id GroupColumn;
errcode number;
code char;
BEGIN
      rg_id := Find_Group(rg_name);
      IF Id_Null(rg_id) THEN
            rg_id := Create_Group(rg_name);
            gc_id := Add_Group_Column(rg_id,'app_code',CHAR_COLUMN,6);
      end if;
      
END;
Code here ......

declare
rg_id RecordGroup;
gc_id GroupColumn;
code char;

BEGIN
      rg_id := Find_group('my_group');
      IF Id_null(rg_id) then
            Message('Record Group '|| 'my_group' || ' does not exist');
      end if;
      gc_id := Find_column('my_group.app_code');
      IF Id_null(gc_id) then
            Message('Column   does not exist');
      end if;
      
Error HERE (FRM-41084 Error Getting Group Cell
-------------------------------------------------------------
             code := Get_Group_Char_Cell('my_group.app_code',1);
      -
      
end;

HArsha

Answer : Record Groups , How ?

You are creating your regord group correctly, also the column.

The problem you are faced with is that the ROW needs to be created before you assign a value to it.

Therefore for each row you create call the ADD_GROUP_ROW function.

Below is a working example.
 
Regards

Paul


PROCEDURE testcreate
IS
  rg_name varchar(30) := 'my_group';
  rg_id   RecordGroup;
  gc_id   GroupColumn;
  errcode number;
  code    varchar2(30);
BEGIN
  rg_id := Find_Group(rg_name);

  IF Id_Null(rg_id)
  THEN
    rg_id := Create_Group(rg_name);
  END IF;
 
  gc_id := Find_column('my_group.app_code');
  IF Id_null(gc_id)
  THEN
    gc_id := Add_Group_Column(rg_id,'app_code',CHAR_COLUMN,6);    
  END IF;

  ADD_GROUP_ROW(rg_id, 1);
  SET_GROUP_CHAR_CELL(gc_id,1,'Hello');  
  code := Get_Group_Char_Cell(gc_id,1);

  message (code); pause;
END;
Random Solutions  
 
programming4us programming4us