How can I create new group with multiple fields in Demographics

Hi All,

I have created new group under demographics by using Administration->Layouts and when I trying to add multiple fields to the newly created group it is not working.

How can I create new group with multiple fields in Demographics ?

Please help me find a solution.

Hi @sinothoma,

You can add new group into demographics using below steps

  1. Got to the Administration->Layouts.
  2. Select the Demographics from drop-down.
  3. Click on the Add Group button for adding new group then save the groups. (Using this you can add groups)
  4. Go to the group that is added and then click add field button to add the new fields for that group.

Please let me know if you have any question that you have.

Thanks,
Nilesh

Hi Nilesh,

Thanks for your support.

I tried the ways which you mentioned,but on the last step.Add new field to the newly created group is not working.

When I trying to add new field showing the following query error

Query Error

ERROR: query failed: INSERT INTO layout_options ( form_id, source, field_id, title, group_id, seq, uor, fld_length, fld_rows, titlecols, datacols, data_type, edit_options, default_value, description, max_length, list_id, list_backup_id ) VALUES ( β€˜DEM’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’,’’ )

Error: Duplicate entry β€˜DEM–0’ for key β€˜PRIMARY’

Hi @sinothoma,

Can please send me the structure for the layout_options table.

Thanks,
Nilesh

Make sure you don’t have a duplicate id DEM-0 already defined in the form!

1 Like

Yes Id should not be duplicate for the form

Hi @Nilesh_Hake

This is the structure if layout_options

CREATE TABLE IF NOT EXISTS layout_options (
form_id varchar(31) NOT NULL DEFAULT β€˜β€™,
field_id varchar(31) NOT NULL DEFAULT β€˜β€™,
group_id varchar(31) NOT NULL DEFAULT β€˜β€™,
title varchar(63) NOT NULL DEFAULT β€˜β€™,
seq int(11) NOT NULL DEFAULT β€˜0’,
data_type tinyint(3) NOT NULL DEFAULT β€˜0’,
uor tinyint(1) NOT NULL DEFAULT β€˜1’,
fld_length int(11) NOT NULL DEFAULT β€˜15’,
max_length int(11) NOT NULL DEFAULT β€˜0’,
list_id varchar(100) NOT NULL DEFAULT β€˜β€™,
titlecols tinyint(3) NOT NULL DEFAULT β€˜1’,
datacols tinyint(3) NOT NULL DEFAULT β€˜1’,
default_value varchar(255) NOT NULL DEFAULT β€˜β€™,
edit_options varchar(36) NOT NULL DEFAULT β€˜β€™,
description text,
fld_rows int(11) NOT NULL DEFAULT β€˜0’,
list_backup_id varchar(100) NOT NULL DEFAULT β€˜β€™,
source char(1) NOT NULL DEFAULT β€˜F’ COMMENT β€˜F=Form, D=Demographics, H=History, E=Encounter’,
conditions text COMMENT β€˜serialized array of skip conditions’,
validation varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

–
– Indexes for table layout_options

ALTER TABLE layout_options
ADD PRIMARY KEY (form_id,field_id,seq);