Forums

double filter dropdown programing

teldrive 11 Sep, 2020
Hi Max, give me some clues to implement double filtering method in CF7, i have
2 filter dropdown where I select the field to filter 'filtro1_sel' 'filtro2_sel'
and in text fields the value to compare 'valor1' 'valor2'

in CF7 I don't see how implement this code-function, because only guided where_conditions are possible and it seems is not posible set variable in the database_field
if(!empty($this->data['filtro1_sel'[li]) && !empty($this->data['valor1'])){
$where1=[/li];
$where1[li]=$this->data['filtro1_sel'];
$where1[/li]="%".$this->data['valor1'[li]."%";
$where1[/li]="LIKE";
if(!empty($this->data['filtro2_sel'[li]) && !empty($this->data['valor2'])){
$where2=[/li];
$where2
  • =$this->data['filtro2_sel'];
    $where2
  • ="%".$this->data['valor2'[li]."%";
    $where2[/li]="LIKE";
    return [$where1,"AND",$where2];
    }else{
    return [$where1];
    }
    }[br]?>

    Max_admin 16 Sep, 2020
    Did you try the "Filter listing" Data behavior in the dropdown settings ? it will auto add a condition when the field value is not empty
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    teldrive 17 Sep, 2020
    Yes I tried and works
    this issue comes from filtering concept ,ccv7's filters : filters from existing values's fields,
    but when you have 10 fields , do you need 10 filters? instead to program a dropdown for each field and filter with it
    I think is more straightforward method, when you want make easy filtering , selecting fields on field's dropdown and writing a value(not always is known the exact value but this reason "%" suits fine on this database_search), this is working for me on ccv6 and ccv5 but when trying to adapt it to cfv7 I failed
    Max_admin 17 Sep, 2020
    I can add a custom PHP conditions behavior where you can build custom conditions like in v6, I will add this to the todo list and you can expect it in a future update!
    Max, ChronoForms developer
    ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
    ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
    This topic is locked and no more replies can be posted.