I have 2 fields, order1 and order2
I only want to show one field in the table view, either order1 or order2 depending on if there is a value, (both fields will never be filled only 1)
I found this on the tips page but it does not work, does anyone know why?
Code: Select all
// get the original fields array
$oldFields = $options->QueryFieldsTV;
// loop through all fields
foreach($oldFields as $field => $title){
// find the field that we need to customize
if($field == '`account`.`order1`'){
// apply custom SQL formatting to the field
$modField = "IFNULL(`account`.`order1`,`account`.`order2`)";
$newFields[$modField] = $title;
}else{
// for other fields, keep them unchanged
$newFields[$field] = $title;
}
}
// now apply the modified fields
$options->QueryFieldsTV = $newFields;