Forums

set a variable on "fields" of db_read or xls_export action

teldrive 04 Jun, 2014
I apreciate if someone can help, i'm not sure if it's implemented on CFv5 but i think is worth to do it , may be you can suggest me any workaround
The issue is to be able of generate excel files truncating some fields depending of user selection
the idea is to have a variable as {fieldsvar} you can concatenate different fields depending of customer selection
$form->data['fieldsvar']= "id,nombre,ratem";

and after apply it into db_read action or xls_export action
[attachment=0]Captura.JPG[/attachment]

we also are using "conditions" field of db_read to link submit_selectors of CC_list to this Excel_export form
<?php
return  array("id" => $form->data['gcb']);
?>
teldrive 05 Jun, 2014
Answer
I 've got it with custom code, but anyway I think could be interesting to add it in db_read action

$form->data['fieldsvar'] ="`id`,`titulo`";
$db =& JFactory::getDBO();
$query = "
     SELECT {$form->data['fieldsvar']}
         FROM `#__paper_form`
          WHERE `id` IN ({$form->data['vals']});
 ";
 $db->setQuery($query);
 $form->data['paper'] = $db->loadAssocList();
?>
teldrive 05 Jun, 2014
I'd like to comment that also include this possibility into xls_export action will do posible rename fields dinamically
This topic is locked and no more replies can be posted.