$aAux = explode('|', $oForm->fields[$oForm->fields[$sField]->pmconnection]->keys);
 $i = 0;
 $aValues = array();
 foreach ($aData['FIELDS'] as $aField) {
     if ($aField['FLD_KEY'] == '1') {
         $aKeys[$aField['FLD_NAME']] = isset($aAux[$i]) ? G::replaceDataField($aAux[$i], $Fields['APP_DATA']) : '';
         $i++;
     }
     if ($aField['FLD_NAME'] == $oForm->fields[$sField]->pmfield) {
         $aValues[$aField['FLD_NAME']] = $Fields['APP_DATA'][$sField];
     } else {
         $aValues[$aField['FLD_NAME']] = '';
     }
 }
 try {
     $aRow = $oAdditionalTables->getDataTable($oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aKeys);
 } catch (Exception $oError) {
     $aRow = false;
 }
 if ($aRow) {
     foreach ($aValues as $sKey => $sValue) {
         if ($sKey != $oForm->fields[$sField]->pmfield) {
             $aValues[$sKey] = $aRow[$sKey];
         }
     }
     try {
         $oAdditionalTables->updateDataInTable($oForm->fields[$oForm->fields[$sField]->pmconnection]->pmtable, $aValues);
     } catch (Exception $oError) {
         //Nothing
     }
 } else {
 /**
  * get a value from a PM Table
  *
  * @param <Object> $oOwner
  * @return <String> $sValue
  */
 public function getPMTableValue($oOwner)
 {
     $sValue = '';
     if (isset($oOwner->fields[$this->pmconnection])) {
         if (defined('PATH_CORE')) {
             if (file_exists(PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php')) {
                 require_once PATH_CORE . 'classes' . PATH_SEP . 'model' . PATH_SEP . 'AdditionalTables.php';
                 $oAdditionalTables = new AdditionalTables();
                 try {
                     $aData = $oAdditionalTables->load($oOwner->fields[$this->pmconnection]->pmtable, true);
                 } catch (Exception $oError) {
                     $aData = array('FIELDS' => array());
                 }
                 $aKeys = array();
                 $aValues = explode('|', $oOwner->fields[$this->pmconnection]->keys);
                 $i = 0;
                 foreach ($aData['FIELDS'] as $aField) {
                     if ($aField['FLD_KEY'] == '1') {
                         // note added by gustavo cruz gustavo[at]colosa[dot]com
                         // this additional [if] checks if a case variable has been set
                         // in the keys attribute, so it can be parsed and replaced for
                         // their respective value.
                         if (preg_match("/@#/", $aValues[$i])) {
                             // check if a case are running in order to prevent that preview is
                             // erroneous rendered.
                             if (isset($_SESSION['APPLICATION'])) {
                                 G::LoadClass('case');
                                 $oApp = new Cases();
                                 if ($oApp->loadCase($_SESSION['APPLICATION']) != null) {
                                     $aFields = $oApp->loadCase($_SESSION['APPLICATION']);
                                     $formVariable = substr($aValues[$i], 2);
                                     if (isset($aFields['APP_DATA'][$formVariable])) {
                                         $formVariableValue = $aFields['APP_DATA'][$formVariable];
                                         $aKeys[$aField['FLD_NAME']] = isset($formVariableValue) ? G::replaceDataField($formVariableValue, $oOwner->values) : '';
                                     } else {
                                         $aKeys[$aField['FLD_NAME']] = '';
                                     }
                                 } else {
                                     $aKeys[$aField['FLD_NAME']] = '';
                                 }
                             } else {
                                 $aKeys[$aField['FLD_NAME']] = '';
                             }
                         } else {
                             $aKeys[$aField['FLD_NAME']] = isset($aValues[$i]) ? G::replaceDataField($aValues[$i], $oOwner->values) : '';
                         }
                         $i++;
                     }
                 }
                 try {
                     $aData = $oAdditionalTables->getDataTable($oOwner->fields[$this->pmconnection]->pmtable, $aKeys);
                 } catch (Exception $oError) {
                     $aData = array();
                 }
                 if (isset($aData[$this->pmfield])) {
                     $sValue = $aData[$this->pmfield];
                 }
             }
         }
     }
     return $sValue;
 }