⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

setRelation returns similar values not only the exact



wildfandango

wildfandango
  • profile picture
  • Member

Posted 09 January 2018 - 09:41 AM

Hello everyone and happy new year!
 
The error that happens to me, possibly related to the database, is very rare and I do not know what can be due or how to solve it ...
:, (
 
I have two related tables
 
_log.usu -> _usu.id
(both fields are of type INT)
 
in the following way:
 
$crud->setRelation('usu', '_ usu', 'name');
In my production environment the GRID shows all the _usu whose ID contains part of the first one, I mean.
 
If _log.usu is 3, all users with id 3, 30, 31 will be shown
 
example, for:
_log.usu = 3
 
users showed:
 
3 -> John
30 -> Marta
31 -> Donald
 
8O ??!!!
 
Any idea of what the problem may be and how to solve it? Thank you
 
P.S. The MySQL version is 5.6.19

wildfandango

wildfandango
  • profile picture
  • Member

Posted 11 January 2018 - 09:39 AM

This is my complete code, any ideas? I'm totally lost

 

        $crud = $this->GCRUD_getGroceryCrudEnterprise();
        $crud->setTable('_log');
        $crud->setSubject("LOG","Registro de LOGS");
        $crud->setTheme($this->ciies_model->cfg()["visual_theme"]);


        $crud->columns(['fec','usu','act','pan','reg']);
        $crud->fields(['fec','usu','act','pan','reg','txt']);


        $crud->displayAs('fec','Fecha/Hora');
        $crud->displayAs('usu','Usuario');
        $crud->displayAs('act','Acción');
        $crud->displayAs('pan','Pantalla');
        $crud->displayAs('reg','ID de REGISTRO');
        $crud->displayAs('txt','Descripción');


        $crud->setRelation('usu','_usu','nombre');


        $crud->setRead();
        $crud->unsetAdd();
        $crud->unsetEdit();
        $crud->unsetDelete();


        $crud->defaultOrdering('fec','desc');


        $output = $crud->render();

darkstalker

darkstalker
  • profile picture
  • Member

Posted 11 January 2018 - 14:44 PM

have you tried to change table name from _usu to something else ?

I feel that the similar name of field and table could produce strange behavior.

Try and see if that resolve the issue


wildfandango

wildfandango
  • profile picture
  • Member

Posted 11 January 2018 - 19:17 PM

It was a possibility, but I tried to rename the _usu table by appusers and the result is exactly the same

 

 

Screenshot


wildfandango

wildfandango
  • profile picture
  • Member

Posted 05 March 2018 - 10:39 AM

After upgrading to version 2.5.1 the problem has been fixed


luciferbrown

luciferbrown
  • profile picture
  • Member

Posted 20 June 2018 - 19:10 PM

The set relation in SQL server which returns the similar values but not the exact value so, for that, you can find out the way to follow it after the version updated then from knowing the process is in condition mode instead of that dell printer support will find out the solution for the above query.