• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2747
  • Last Modified:

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
0
harssha
Asked:
harssha
1 Solution
 
sgantaCommented:
Hi,

>> code := Get_Group_Char_Cell('my_group.app_code',1);

I observed that the variable "CODE" is of datatype of CHAR
i.e., length = 1.

Pl. check the data type and maximum length of   "app_code" in
the record group "MY_GROUP" matching with the length of the code.

Probably,

You can do one thing.

Change this statement

code CHAR

to

code  VARCHAR2(64);

and see how it works, Probably this may be the cause.
                 -
0
 
sgantaCommented:
Hi

Your my_group.app_code may be more than one character.
Please increase the character length of the code.
0
 
sgantaCommented:
The cause of the error is
FRM-41084:  Error getting Group Cell.

Cause:      Invalid call to GET_GROUP_CHAR_CELL, GET_GROUP_DATE_CELL, OR GET_GROUP_NUMBER_CELL.

Action:      Make sure the column type is of CHAR, DATE, or NUMBER, respectively.  Check the validity of the row number and column name specified.

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
sgantaCommented:

I am sorry, that is not meant for answer
0
 
harsshaAuthor Commented:
Edited text of question.
0
 
Mark GeerlingsDatabase AdministratorCommented:
I'm wondering why you use a record group to check for duplicates?  Yes, it will be fast and will not cause network traffic, but don't you need to have a primary or unique key in the database also both to assure uniqueness and to support fast access?  If you are using just the form to check for duplicates, what happens if two people at the same time insert detail records for the same master?  Each set of records may be unique as far as each form knows, but duplicates could be in inserted into the database this way.

A pre-insert trigger that checks the database for uniqueness would also be user-friendly and with proper indexing and a well-tuned network should not add noticeably to the response time.
0
 
harsshaAuthor Commented:
Thanks a ton for your valuable comments, I have taken care of above points during the Design time.
Written some DB Triggers and Sequences.
When I thouht , I was almost thru with the form , found the need for checking the duplication entries in the form. Shall be grateful to you, if you could give me the solution .


Harsha
0
 
PFHarrisonCommented:
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;
0
 
harsshaAuthor Commented:
Dear PFHarrison,

Thanks a Ton, I acceptyour answer.

It works.

Harsha
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now