 integrating the node example module for the new table defined by the node example module to be understood by the views module you need to create a nodeexampleviewsinc file that describes the table and its relationships to the rest of the database in order for views to know that this file is to be loaded you need to implement hookviewsapi this is done by adding the following function into your nodeexamplemodule file php implementation of hookviewsapi this tells drupal that there is views integration file named modulenameviewsinc function nodeexampleviewsapi note that you can include path in this array so that your viewsinc file can be stored in a different location return array api 20 below is the contents of a simple nodeexampleviewsinc file that allows you to create views that include the new color and quantity information php id apiexamplehtml v 12 20090915 154414 merlinofchaos exp this file is used to tell the views module about the new nodeexample table database definition code create table nodeexample vid int 10 unsigned not null default 0 nid int 10 unsigned not null default 0 color varchar 255 not null default quantity int 10 unsigned not null default 0 primary key vid nid key nodeexamplenid nid endcode function nodeexampleviewsdata basic table information nodeexample table new group within views called example the group will appear in the ui in the dropdown tha allows you to narrow down which fields and filters are available data array data nodeexample table group t example let views know that our example table joins to the node base table this means it will be available when listing nodes and automatically make its fields appear we also show up for node revisions data nodeexample table join array noderevisions array leftfield vid field vid node array leftfield vid field vid quantity data nodeexample quantity array title t quantity help t quantity of items field array handler viewshandlerfieldnumeric click sortable true filter array handler viewshandlerfilternumeric sort array handler viewshandlersort color data nodeexample color array title t color help t color of item field array handler viewshandlerfield click sortable true filter array handler viewshandlerfilterstring argument array handler viewshandlerargumentstring sort array handler viewshandlersort return data some notes on usage within views click on the add tab you have a number of type options here normally you would select either node if you only want to display information on current nodes or node revision if you want to display information on all revisions of the nodes with this configuration you always pull out of the database data for every single node whether or not it has color and quantity information to display information on just those nodes that have color and quantity information you can use a filter so that only nodes which don t have a null color or a null quantity are displayed type relationship extension when your tables have first class data you will often need to have own view types and view relationships defined with the current nodeexample table this isn t required although i try to justify it below on an efficiency basis see http groupsdrupalorg node 17236 comment58980 this discussion as to why it isn t justified pulling data out of the database for every node when you only want data for the new example node type is inefficient to reduce the initial data extraction to just that relating to the new example nodes requires that you make the nodeexample table the base table this can be done by adding the following code into the nodeexampleviewsinc file just before the return data php begin optional extra for type and relationships use nodeexample as a new base table by creating a new views type called node example this allows it to be selected as the view type when you initially add a new view data nodeexample table base array field vid title t node example help t node example type with color and quantity information weight 9 when using the new node example type you need to use relationships to access fields in other tables relationship to the node revision table data nodeexample vid array title t node revision help t the particular node revision the color and quantity is attached to relationship array label t node revision base noderevisions base field vid this allows us to not show this relationship if the base is already noderevisions so users won t create circular relationships skip base array node noderevisions relationship to the node table data nodeexample nid array title t node help t the particular node the color and quantity is attached to relationship array label t node base node base field nid this allows us to not show this relationship if the base is already node so users won t create circular relationships skip base array node noderevisions end optional extra for type and relationships the above code adds a new node example to the view types that can be selected within the add tab window of views selecting this sets the nodeexample table to be the base table if you select node example as view type when you initially go into the edit window of views you will find the only fields available are the color and quantity fields to get fields from other tables you need to add a relationship relationships may be found at the top in the same column as the fields  