XML Form Generator Error

angellimas wrote on Tuesday, July 03, 2012:

Hi, I followed the steps for installing the XML Form Generator, I want to install the form “Communication Log” to see how it works, I already have the form at Administration >Others > Forms, but when I try to “install DB” it gives me this error

ERROR: query failed: CREATE TABLE IF NOT EXISTS `form_communication` ( /* both extended and encounter forms need a last modified date */ date datetime default NULL comment ‘last modified date’, /* these fields are common to all encounter forms. */ id bigint(20) NOT NULL auto_increment, pid bigint(20) NOT NULL default 0, user varchar(255) default NULL, groupname varchar(255) default NULL, authorized tinyint(4) default NULL, activity tinyint(4) default NULL, contact_date datetime default NULL, contact_name varchar(255), phone varchar(15), direction varchar(255), contact_success varchar(255), reason TEXT, result TEXT, screener int(11) default NULL, signature_box varchar(60), PRIMARY KEY (id) ) TYPE=InnoDB

Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘TYPE=InnoDB’ at line 21

What can I do, I want to make my own forms from XML files, because I need to format the report that it prints.

angellimas wrote on Tuesday, July 03, 2012:

I don’t what to modify @table.sql

angellimas wrote on Tuesday, July 03, 2012:

BTW, Im running OpenEMR 4.1.0 on EasyPHP 5.3.9 (PHP 5.3.9 VC9 | Apache 2.2.21 VC9 | MySQL 5.5.20 | PhpMyAdmin 3.4.9 | Xdebug 2.1.3) on Windows 7 Ultimate.

yehster wrote on Wednesday, July 04, 2012:

http://sourceforge.net/projects/openemr/forums/forum/202506/topic/5303003
The cause of your problem is a syntax incompatibility (TYPE instead of ENGINE) and the that other thread discusses options/details.

bradymiller wrote on Wednesday, July 04, 2012:

Hi,

Replace the following file at ‘openemr/contrib/forms/xmlformgen/xslt/table.sql.xslt’ with this one:
http://raw.github.com/openemr/openemr/master/contrib/forms/xmlformgen/xslt/table.sql.xslt

Then run the XML Form Generator again, and it should work.

This fix will be in the next release (and the next 4.1.0 patch).

-brady
OpenEMR

bradymiller wrote on Wednesday, July 04, 2012:

odd,
The github link requires login to github. Here’s the same file from the sourceforge repo, which works:
http://openemr.git.sourceforge.net/git/gitweb.cgi?p=openemr/openemr;a=blob_plain;f=contrib/forms/xmlformgen/xslt/table.sql.xslt;hb=3d4d206e9ab2635eeaecbc2cf21c6c83b690300f

angellimas wrote on Wednesday, July 04, 2012:

Hey, thanks! It worked :slight_smile:

One question.

Once the form it’s done, is there a way to modify it?? I mean, if I need to change a field type, like textbox to list or something, but not generate it again, I think it’s on the 6 files that the XMLFormGen generates, but I dont have idea which one :S

angellimas wrote on Wednesday, July 04, 2012:

Hi! I already installed the form, now the problem is, isn’t not saving the data :frowning: , when I fill up the form, I click on “Save” and nothing happens, I replace this file on the XFG

http://openemr.git.sourceforge.net/git/gitweb.cgi?p=openemr/openemr;a=blob_plain;f=contrib/forms/xmlformgen/xslt/table.sql.xslt;hb=3d4d206e9ab2635eeaecbc2cf21c6c83b690300f

bradymiller wrote on Friday, July 06, 2012:

Hi,

Ensure you have mysql configured correctly, which is overviewed here:
http://www.open-emr.org/wiki/index.php/OpenEMR_4.1_Windows_Installation#Required_Software_Installation

(If not using the XAMPP package, then ensure when configuring MySQL for OpenEMR, STRICT_MODE must be disabled. This can be done using the MySQL Server Instance Configuration wizard or in the my.cnf file. You can check the setting in an existing MySQL instance by executing SHOW VARIABLES; in the MySQL Command Line Client and checking the value of SQL_MODE. For more details see: http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html)

-brady
OpenEMR

angellimas wrote on Friday, July 06, 2012:

Hi, Im using  EasyPHP 5.3.9, Im using the default MySQL admin account, thats, “root” but it hasnt a pass, will be that a problem?

Thanks.

bradymiller wrote on Saturday, July 07, 2012:

Hi,

Note OpenEMR 4.1.0 is not compatible with newer XAMPP and WAMP packages (so guessing EasyPHP may also have issues). It appears this bug has been fixed in OpenEMR 4.1.1 (likely won’t be released until August). You can try a daily build of the development 4.1.1 version here:
http://www.open-emr.org/wiki/index.php/OpenEMR_Development_Version_Windows_Installation
(if it works, then let us know)

Also, ensure that your mysql server does not have STRICT_MODE enables (this is set in the mysql configuration file in the sql_mode parameter).

As an aside, the root not having a password will not affect anything (although some think this would not be considered secure).

-brady
OpenEMR

1 Like

angellimas wrote on Tuesday, July 10, 2012:

Hi, I tried to disable “STRICT_MODE” but I can’t find it @ my.ini file, here’s my code

# IMPORTANT
# ${path} is used to specify EasyPHP installation path
# MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is C:\mysql\data) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
password	= mysql
port		= 3306
socket		= /tmp/mysql.sock
[mysql]
default-character-set=utf8
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
#Path to installation directory. All paths are usually resolved relative to this.
basedir="${path}/mysql/"
#Path to the database root
datadir="${path}/mysql/data/"
bind-address = 127.0.0.1
socket		= /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
# 
#skip-networking
# REPLICATION
# ----------------------------------------------------------------------
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# binary logging format - mixed recommended
binlog_format=mixed
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id	= 1
# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
# Point the following paths to different dedicated disks
#tmpdir		= /tmp/		
#log-update 	= /path-to-dedicated-directory/hostname
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = C:\mysql\data/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = C:\mysql\data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

bradymiller wrote on Wednesday, July 11, 2012:

Hi,

Guessing your sql_mode setting is blank then (which is what you want). If you type SHOW VARIABLES; in the MySQL commadline it will show the value of sql_mode (ensure it does not contain STRICT_MODE.

Your main issue though as described above is that the EasyPHP appears to be WAMP, of which more recent version are not compatible with OpenEMR 4.1.0. You could test this by installing the development version of OpenEMR 4.1.1-dev and testing it out: http://www.open-emr.org/wiki/index.php/OpenEMR_Development_Version_Windows_Installation

-brady
OpenEMR

angellimas wrote on Wednesday, July 11, 2012:

Hi, thanks! I installed 4.1.1-dev and now it’s saving the data! But isn’t printing the info :S

This is my print.php file

<?php
/*
 * The page shown when the user requests to print this form. This page automatically prints itsself, and closes its parent browser window.
 */
/* for $GLOBALS[], ?? */
require_once('../../globals.php');
/* for acl_check(), ?? */
require_once($GLOBALS['srcdir'].'/api.inc');
/* for generate_form_field, ?? */
require_once($GLOBALS['srcdir'].'/options.inc.php');
/** CHANGE THIS - name of the database table associated with this form **/
$table_name = 'form_communication';
/** CHANGE THIS name to the name of your form. **/
$form_name = 'Communication Log';
/** CHANGE THIS to match the folder you created for this form. **/
$form_folder = 'communication_log';
/* Check the access control lists to ensure permissions to this page */
$thisauth = acl_check('patients', 'med');
if (!$thisauth) {
 die($form_name.': Access Denied.');
}
/* perform a squad check for pages touching patients, if we're in 'athletic team' mode */
if ($GLOBALS['athletic_team']!='false') {
  $tmp = getPatientData($pid, 'squad');
  if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
   $thisauth = 0;
}
$returnurl = $GLOBALS['concurrent_layout'] ? 'encounter_top.php' : 'patient_encounter.php';
if ($xyzzy['contact_date'] != '') {
    $dateparts = split(' ', $xyzzy['contact_date']);
    $xyzzy['contact_date'] = $dateparts[0];
}
/* define check field functions. used for translating from fields to html viewable strings */
function chkdata_Date(&$record, $var) {
        return htmlspecialchars($record{"$var"},ENT_QUOTES);
}
function chkdata_Txt(&$record, $var) {
        return htmlspecialchars($record{"$var"},ENT_QUOTES);
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<!-- declare this document as being encoded in UTF-8 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta>
<!-- supporting javascript code -->
<!-- for dialog -->
<script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/dialog.js"></script>
<script type="text/javascript" src="<?php echo $GLOBALS['webroot']; ?>/library/textformat.js"></script>
<!-- Global Stylesheet -->
<link rel="stylesheet" href="<?php echo $css_header; ?>" type="text/css"/>
<!-- Form Specific Stylesheet. -->
<link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/style.css" type="text/css"/>
<title><?php echo htmlspecialchars('Print '.$form_name); ?></title>
</head>
<body class="body_top">
<div class="print_date"><?php xl('Printed on ','e'); echo date('F d, Y', time()); ?></div>
<form method="post" id="<?php echo $form_folder; ?>" action="">
<div class="title"><?php xl($form_name,'e'); ?></div>
<!-- container for the main body of the form -->
<div id="print_form_container">
<fieldset>
<!-- display the form's manual based fields -->
<table border='0' cellpadding='0' width='100%'>
<tr><td class='sectionlabel'><input type='checkbox' id='form_cb_m_1' value='1' onclick='return divclick(this,"contact")' checked="checked" />Who</td></tr><tr><td><div id="print_contact" class='section'><table>
<!-- called consumeRows 014--> <!--  generating 4 cells and calling --><td>
<span class="fieldlabel"><?php xl('Date','e'); ?>: </span>
</td><td>
   <input type='text' size='10' name='contact_date' id='contact_date' title='Date contact occured/was attempted'
    value="<?php $result=chkdata_Date($xyzzy,'contact_date'); echo $result; ?>"
    />
</td>
<!--  generating empties --><td class='emptycell' colspan='1'></td></tr>
<!-- called consumeRows 014--> <!--  generating 4 cells and calling --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Name','e').':'; ?></td><td class='text data' colspan='3'><?php echo generate_form_field($manual_layouts['contact_name'], $xyzzy['contact_name']); ?></td><!--  generating empties --><td class='emptycell' colspan='1'></td></tr>
<!-- called consumeRows 014--> <!--  generating 4 cells and calling --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Phone #','e').':'; ?></td><td class='text data' colspan='3'><?php echo generate_form_field($manual_layouts['phone'], $xyzzy['phone']); ?></td><!--  generating empties --><td class='emptycell' colspan='1'></td></tr>
<!-- called consumeRows 014--> <!-- just calling --><!-- called consumeRows 224--> <!--  generating 4 cells and calling --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Outgoing Call?','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['direction'], $xyzzy['direction']); ?></td><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Contact Successful?','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['contact_success'], $xyzzy['contact_success']); ?></td><!--  generating empties --><td class='emptycell' colspan='1'></td></tr>
<!-- called consumeRows 014--> <!-- just calling --><!-- called consumeRows 224--> <!-- generating not($fields[$checked+1]) and calling last --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Reasons for contact','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['reason'], $xyzzy['reason']); ?></td><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Results of conversation','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['result'], $xyzzy['result']); ?></td><!-- called consumeRows 424--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
</table></div>
</td></tr> <!-- end section contact -->
<tr><td class='sectionlabel'><input type='checkbox' id='form_cb_m_2' value='1' onclick='return divclick(this,"staff")' checked="checked" />Agency Representitive</td></tr><tr><td><div id="print_staff" class='section'><table>
<!-- called consumeRows 014--> <!-- just calling --><!-- called consumeRows 224--> <!-- generating not($fields[$checked+1]) and calling last --><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Access Screener','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['screener'], $xyzzy['screener']); ?></td><td class='fieldlabel' colspan='1'><?php echo xl_layout_label('Signature','e').':'; ?></td><td class='text data' colspan='1'><?php echo generate_form_field($manual_layouts['signature_box'], $xyzzy['signature_box']); ?></td><!-- called consumeRows 424--> <!-- Exiting not($fields) and generating 0 empty fields --></tr>
</table></div>
</td></tr> <!-- end section staff -->
</table>
</fieldset>
</div><!-- end print_form_container -->
</form>
<script type="text/javascript">
window.print();
window.close();
</script>
</body>
</html>

angellimas wrote on Wednesday, July 11, 2012:

Im thinking about installing WAMPP 2.0, Im just testing XMLFormGen, but ass I see, isnt compatible at all with EasyPHP :S

angellimas wrote on Wednesday, July 11, 2012:

Well, I already installed OpenEMR with XAMPP 1.7.3, and its saving the data (XMLFormGen) but isnt printing it.