I am creating a module with views, I have just created a page which creates a view with a filter coming from arguments, but the sql fail. The code is: <?php $view = views_create_view('llista_assentaments', 'Llista dels assentaments'); views_view_add_page($view,t('Llista de projectes'), 'comptacau/llista_assentaments', 'table', true, 2, '', 1, false); //trans views_view_add_field( $view, 'node','title',t('nom'), TRUE, 0,'views_handler_field_nodelink'); views_view_add_field( $view, 'comptacau_assentaments', 'projecte_nid', "projecte_nid", TRUE, 0, ''); views_view_add_filter($view, 'node', 'type', '=', 'comptacau_assentament', ''); views_view_add_filter($view, 'node', 'status', '=', 1, ''); views_view_add_filter($view, 'comptacau_assentaments', 'projecte_nid', '=', $nid, ''); drupal_set_message("vista: ".nl2br(print_r($view,true))); //debug views_sanitize_view($view); return views_build_view('page', $view, array(), false); ?> and the error is: <code> SELECT DISTINCT(node.nid), node.title AS node_title, node.changed AS node_changed, comptacau_assentaments.project AS comptacau_assentaments_projecte_nid FROM ccc_node node LEFT JOIN ccc_comptacau_assentaments comptacau_assentaments ON node.nid = comptacau_assentaments.nid INNER JOIN ccc_node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 4 AND na.realm = 'comptacau') OR (na.gid = 1 AND na.realm = '4_comptacau') OR (na.gid = 1 AND na.realm = '4_comptacau_2'))) AND ( (node.type = 'comptacau_assentament') AND (node.status = '1') AND (.projecte_nid = '5') ) //?!?!?!?!?! ORDER BY node_title ASC </code> The problem is it don't detect the table, but I have done a print_r and it appears well done: <code> ......... [filter] => Array ( ................ [2] => Array ( [tablename] => comptacau_assentaments [field] => projecte_nid [operator] => = [value] => 5 [options] => ) ) ............. </code> I thought the problem may be when definig the field, but if i remove this filter, the field is loaded and shown correctly in the screen. any hint of where is the error? thanks -- *Si tu fas una foto a una vaca, la vaca no et diu re. *Envellim quan els records superen les esperances. *Als llocs desconeguts només s'hi arriba per camins desconeguts. *Abans d'imprimir aquest missatge, pensa en el medi ambient.