/**
  * Aplicar una regla antes definida
  * @ignore
  * @param $datForm	Datos de form
  * @param $idList	Id de la lista
  * @return string
  */
 public function MYLIST_applyRuleQuery($datForm, $idList)
 {
     // Tildes / Case Sensitive
     $kwNa = $kwCs = '';
     $someValues = false;
     $someNullValues = false;
     $sqlRule = '';
     $myList = new OPF_myList($idList);
     $engineDb = $myList->getVar('engineDb');
     if (isset($this->myDinamicListCSkW[$engineDb])) {
         $kwCs = $this->myDinamicListCSkW[$engineDb];
     }
     if (isset($this->myDinamicListAcentkW[$engineDb])) {
         $kwNa = $this->myDinamicListAcentkW[$engineDb];
     }
     $arAlInQry = $myList->getVar('arrayAliasSetInQuery');
     $numRules = $myList->getVar('numRuleQuery');
     for ($i = 1; $i <= $numRules; ++$i) {
         if (isset($datForm['field_' . $i])) {
             $val = trim($datForm['value_' . $i]);
             if (strlen($val)) {
                 $someValues = true;
                 if (in_array($datForm['relation_' . $i], array('in', 'notin'))) {
                     $nVal = '(';
                     $vals = explode(',', $val);
                     foreach ($vals as $nVals) {
                         if (!is_numeric($nVals)) {
                             $nVals = '\'' . $nVals . '\'';
                         }
                         $nVal .= $nVals . ',';
                     }
                     $val = substr($nVal, 0, -1) . ')';
                 } else {
                     if (in_array($datForm['relation_' . $i], array('like', 'notlike'))) {
                         $val = '\'' . $val . '\'';
                     } else {
                         if (!is_numeric($val)) {
                             $val = '\'' . $val . '\'';
                         }
                     }
                 }
                 $fieldQuery = '"' . $datForm['field_' . $i] . '"';
                 if (isset($arAlInQry[$datForm['field_' . $i]])) {
                     $fieldQuery = $arAlInQry[$datForm['field_' . $i]];
                 }
                 $sqlRule = $datForm['logic_' . $i] . ' ';
                 if (!is_numeric($val)) {
                     if (!$datForm['case_sensitive_' . $i]) {
                         $sqlRule .= $kwNa . '(' . $kwCs . '(' . $fieldQuery . '))';
                     } else {
                         $sqlRule .= $fieldQuery;
                     }
                 } else {
                     $sqlRule .= $fieldQuery;
                 }
                 $sqlRule .= ' ' . '' . $this->myDinamicListRel[$datForm['relation_' . $i]] . ' ';
                 if (!is_numeric($val)) {
                     if (!$datForm['case_sensitive_' . $i]) {
                         $sqlRule .= $kwNa . '(' . $kwCs . '(' . $val . '))';
                     } else {
                         $sqlRule .= $val;
                     }
                 } else {
                     $sqlRule .= $val;
                 }
                 $myList->setVar('arrayWhereRules', $sqlRule, $i);
                 $this->assign('value_' . $i, 'className', 'caja');
                 $this->assign('status_' . $idList . '_' . $i, 'className', 'rule_apply');
             } else {
                 $someNullValues = true;
                 $this->assign('value_' . $i, 'className', 'caja_required');
             }
         }
     }
     if ($someValues) {
         $myList->setVar('maxNumPage', 0);
         $myList->setVar('currentPage', 0);
         $this->assign($idList, 'innerHTML', $myList->getList());
         if ($myList->isSuccessfulProcess()) {
             if ($myList->getNumRowsAffected()) {
                 $this->notificationWindow(MSG_QUERY_FORM_OK, 3, 'ok');
             } else {
                 $this->notificationWindow(MSG_QUERY_FORM_NOROWS, 3, 'info');
             }
         } else {
             $this->notificationWindow(MSG_QUERY_FORM_BAD, 3, 'error');
             $myList->unSetVar('arrayWhereRules', $i);
         }
         $js = 'clearRowsMarked();' . "\n";
         $this->script($js);
     } else {
         $this->notificationWindow(MSG_APPLY_RULES_ALL_VALUES_NULL, 3, 'warning');
     }
     return $this->response;
 }