Recovering Deleted Layout Groups

Greetings!

I made a big mistake.

I delete layout -demography-contact group.

Then i can’t make any appointment at OPENEMR with this error message

ERROR: query failed: SELECT lname, fname, phone_home, phone_biz, DOB FROM patient_data WHERE pid = ?

Error: Unknown column ‘phone_home’ in ‘field list’

The back up was done 3 weeks ago, so no helpful.

OS:window 8
Pre-installed OpenEMR with the XAMPP 4.4.2

If i upgrade to 5.0 then, can i restore all the data(phone numbers) and working?
or any solution?
Please help

From Hugh

@c_hugh,

Deleted groups can be added using database.sql file in openEMR.
But the values can’t be restored without the backup.

Thanks,
ViSolve

i see. Thank you for explain, then how to use database.sql file to add current openemr?

Many thanks
Hugh

1.Goto openemr/sql/database.sql file and contact group queries;

sample query :

INSERT INTO layout_options (form_id,field_id,group_name,title,seq,data_type,uor,fld_length,max_length,list_id,titlecols,datacols,default_value,edit_options,description,fld_rows) VALUES (‘DEM’, ‘street’, ‘2Contact’, ‘Address’, 1, 2, 1, 25, 63, ‘’, 1, 1, ‘’, ‘C’, ‘Street and Number’, 0);

2.Copy all the queries which are having ‘2Contact’ as group_name ;

Note : please take a backup of database before run this queries;

Thanks,
ViSolve

1 Like

Thanks Visolveemr.

Where i can find ‘openemr/sql/database.sql file and contact group queries’.

in xampp folder or run openemr then administration menu? Sorry for this question,So far i can’t make any charge funtion, sales report etc.

Many thanks

Hugh

Do you mean c/xampp/htdocs/openemr/sql/database ?

After i copy all the queries where i need to put it?

Thank you for your great help,

I solved with Demo version of OPENEMR.

Thanks~~

@c_hugh,

You can find the file under Xampp/Your OpenEMR folder/sql/database.sql .
Kindly check the above path and let us know if you have any clarifications.

Thanks,
ViSolve

@c_hugh,

We have lot of queries in database.sql file .You can copy the required queries to re-create the deleted columns from patient data table.

sample query :
INSERT INTO layout_options (form_id,field_id,group_name,title,seq,data_type,uor,fld_length,max_length,list_id,titlecols,datacols,default_value,edit_options,description,fld_rows) VALUES (‘DEM’, ‘street’, ‘2Contact’, ‘Address’, 1, 2, 1, 25, 63, ‘’, 1, 1, ‘’, ‘C’, ‘Street and Number’, 0);

Note : Copy all the queries which are having ‘2Contact’ as group_name ;

We need to run the copied queris in MySQL . In Xampp , We can use phpMyadmin to run the queries.

ViSolve

@c_hugh,

Its Glad to hear that your issue got resolved.

It would be better if you share the steps which you were followed to resolve your issue.
It may help others who are all having same type of issue .

Thanks,
ViSolve

1 Like

Thank you so much

Hugh