Problem with SELECT in CFv4

zingeonaut 16 Jun, 2013
Hi, I'm new to this forum so I'll try to keep it short. I've been using ChronoForms v4 with Joomla 2.5.11 on this project I'm working on for the last month, but I have found a little problem: I'm making a form where i need to customize the SELECT query and I haven't found a way to do it. Long story short, i have a simple SELECT that i have tried directly on the DB and it's running, but it includes a CASE/IF statement. Does anybody know how to do that in CF? Thanks
GreyHead 17 Jun, 2013
Hi zingeonaut,

You can do that most easily in a Custom Code action. It will be something like this:
$db =& JFactory::getDBO();
$query = "
    SELECT `id`, IF(`a` = 1, 'b', 'c') 
        FROM `#__some_table`
        WHERE `some_input` = 'somevalue' ;
$form->data['my_results'] = $db->loadAssocList();

zingeonaut 17 Jun, 2013
Ok, but that way i wouldn't be able to use the Standard data displayer from chronoForms, right?

I also put a Custom code section inside the on Record Found in the DB Multi Record Loader


foreach ($form->data as &$value) {


the Custom code is configured in Mode: Controller
This topic is locked and no more replies can be posted.