Timeline for How to add where clause to custom Drupal view
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 19, 2016 at 12:42 | comment | added | Suresh R | Try to put dpm($query) after $query->add_where(1,'kfd_survey_master_survey_id','kfd_other_works_form_id','=');, And check if your table is present in table_queue[] and if your where condition is present in where[]. You will get better idea. FYI, it doesn't matter if it is after hook_view_data or not. | |
| Feb 19, 2016 at 12:32 | comment | added | Mukesh Gami | function kfd_views_query_alter(&$view, &$query) { if ($view->name == 'report1') { $query->add_where(1,'kfd_survey_master_survey_id','kfd_other_works_form_id','='); } } i am adding this code right after defining hook_view_data..but its showing whole table...where contition does not showing any effect. | |
| Feb 19, 2016 at 4:30 | vote | accept | Mukesh Gami | ||
| Feb 18, 2016 at 12:44 | comment | added | Suresh R | Yes, you can add it, provided the table_name is already available in the query. Or else you need to add the table to the query. For more info, refer this question stackoverflow.com/questions/16959241/… | |
| Feb 18, 2016 at 12:37 | comment | added | Mukesh Gami | can u elaborate parameter you are passing in add_where function...can i add table_name.field_name in place of $value variable..i am implementing this hook_view_query_alter in "views.inc" file | |
| Feb 18, 2016 at 11:01 | history | answered | Suresh R | CC BY-SA 3.0 |