quote($var);pr({$var}); // i obtain nothing$var_array=explode(',',{$var}); // i need an array to get all "sesion" IN $var_arrayreturn array("sesion" => $var_array);?>"> complex condition con CC model based on array - Forums

Forums

complex condition con CC model based on array

teldrive 16 Sep, 2014
Hi everyone, apreciate some help
based on interesting linkhttps://www.chronoengine.com/faqs/72-ccv5/5215-how-do-i-build-a-where-statement-in-ccv5.html
but i tried to put on practice

I have a model.field string like this "1,2,5,6,7" and i need obtain it "visible" in condition box of model 1
but i couldnt, let me show you what i tried:
"model" in my case is "moder"
and "field" on my case is "sesiones" that has to be converted to array
<?php
$var = JRequest::getVar('sesiones','', 'get');
pr($var); // i obtain nothing
$var = \GCore\Models\moder::getInstance()->dbo->quote($var);
pr({$var}); // i obtain nothing
$var_array=explode(',',{$var}); // i need an array to get all "sesion" IN $var_array
return array("sesion" => $var_array);
?>
Max_admin 17 Sep, 2014
Hi Teldrive,

Ok, the key is in this line:
$var = JRequest::getVar('sesiones','', 'get');

Do you pass the "sesiones" variable in thr url or how do you expect to get it ?

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
teldrive 17 Sep, 2014
Hi Max, thanks by reply
the issue(i don't know if posible) is how to get the value of a field in CC(in case it is an string and I want to change to array)
[attachment=0]Captura.JPG[/attachment]
the condition code i am pursuing is
<?php
$sesion_array=explode(",",moder.sesiones);
return array(“paper.sesion" => $sesion_array);
?>

the debug shows `paper`.`sesion` = `moder`.`id` I could never print on screen "moder.sesiones"
Array
(
    [0] => SELECT `Extension`.`id` AS `Extension.id`, `Extension`.`name` AS `Extension.name` FROM `jos_chronoengine_extensions` AS `Extension` WHERE `Extension`.`enabled` = '1' ORDER BY `Extension`.`ordering` ASC
    [1] => SELECT `Connection`.`id` AS `Connection.id`, `Connection`.`title` AS `Connection.title`, `Connection`.`params` AS `Connection.params`, `Connection`.`extras` AS `Connection.extras`, `Connection`.`published` AS `Connection.published` FROM `jos_chronoengine_connections` AS `Connection` WHERE `Connection`.`title` = 'moder_paper_list' AND `Connection`.`published` = '1'
    [2] => SELECT COUNT(*) AS `paper.count` FROM `jos_paper_form` AS `paper` LEFT JOIN `jos_moderador_form` AS `moder` ON `paper`.`sesion` = `moder`.`id` WHERE `moder`.`nif` = '03442947P'
    [3] => SELECT `paper`.`id` AS `paper.id`, `paper`.`titulo` AS `paper.titulo` FROM `jos_paper_form` AS `paper` LEFT JOIN `jos_moderador_form` AS `moder` ON `paper`.`sesion` = `moder`.`id` WHERE `moder`.`nif` = '03442947P' LIMIT 30
)
Max_admin 18 Sep, 2014
Your previous code is ok, but how do you expect the get the value of "sesiones" ? because this is first line and it affects all the code!

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
teldrive 18 Sep, 2014
Hi Max
i have a CC working like this, first filter one record with ID user
<?php
$user =& JFactory::getUser();
$login=$user->username;
//pr(" Trabajos asignados al Evaluador con el NIF  :   ".$login);
 return array("moder.nif" =>$login);
 ?>

and after filter records of model1 usignd field of model2 example paper.sesion=moder.sesion

the issue here is that i have an string with several values ,moder.sesion= "1,5,6,8"
and i need to convert moder.sesion to $sesion_array previus to do this return array(“paper.sesion" => $sesion_array);
i tried to print value of moder.sesiones but never get this,
the doubt is how can i get model1 records that are related to model 2 as string_array(comma separated)?
<?php
 $sesion_array=explode(",",moder.sesiones);
 pr(moder.sesiones);
 ?>
teldrive 21 Sep, 2014
Answer
Hi Max
after some searching i think is not posible to do this, I have got it with a custom list display
thanks anyway
This topic is locked and no more replies can be posted.