« Evaluating CCK3 and MultiGroup | Main | User registration workflow: URL redirects »

October 08, 2010

How to for the Data Module

I'm still wrapping my head around this module. Basically, it allows you to expose individual tables (data tables) to the Views module. Here are my notes. The original post is here.

Note, a colleague also experimented with the Data Module and posted his notes here.

- The Data Module and its required modules are installed/enabled.
- Basic working knowledge of Data and Views
- Ability to do direct database insertions

1) Create new Table by going to admin/build/data/create
- An export of my table, data_table_x, is attached.
Note: I used phpMyAdmin to make my ID column auto-increment

2) Insert data into data_table_x
- I used phpMyAdmin to manually insert 3 rows :
id, variable_x, node_ref_id
1, 234, 8021
2, 253, 8021
3, 323, 8021

- The first two columns are arbitrary, node_ref_id column contains the NID of the node I want to reference.
- The Feeds module can be used to accomplish steps 1 and 2.

3) Relate to nodes. Go to admin/build/data/edit/data_table_x/node and specify the Content Type you want to relate to and the column with the NID of the node you want to relate to (node_ref_id, in this case.)

4) Browse to admin/content/data/view/data_table_x, you should see your data. If not, then back to the drawing board with you.

5) Manually populate data_table_node table.
- Again, through phpMyAdmin, I inserted 1 row:
nid, data_table_name, id
8021, data_table_x, 8021

- Note: Is it by design that you need to manually update this table? I do not know.

6) Modify view so the Node Title of the referenced node is visible.
- Edit data_table_x view: admin/build/views/edit/data_table_x
- Add a relationship: Data node: Data table
- Add another relationship: Data node: Node
- Add Node Title field (with mandatory relationship) > "Exclude from display" & "Link this field to its node"
- Modify Table > Style Options to group by Node Title.
- Save
- See export of this view attached.

- The relationship 'Data node: Node' is not available until relationship 'Data node: Data table' is added
- Node Title field cannot be added until relationships are specified

Posted by kkwaiser at October 8, 2010 04:12 PM


Login to leave a comment. Create a new account.