By Anonymous (not verified) on
Hello guys. I'm really having a hard time in joining my table's fields to the node table's fields. any body who can show some complete code on how to use it? a simple one will do.
Hello guys. I'm really having a hard time in joining my table's fields to the node table's fields. any body who can show some complete code on how to use it? a simple one will do.
Comments
I posted a quick little view
I know this is for users not nodes, but...
I posted a quick little view for the sessions table a couple of days ago here. Another quick file to look at is og_rsvp.
just wrap it in a function and add the return $data.
Im sorry it should be
Im sorry it should be hook_views_data, In the advance help it says that it is used in describing table to views so that views will be aware of my custom table. The problem is that I don't have a proper direction or even a clear guide on how to do it. tried it a couple of times but still my table doesn't show up on the views settings.
heres my code:
I've also saved the file in reports.views.inc under includes folder which is inside my modules directory.
A couple of things: You do
A couple of things:
You do have the new hook_views_api() function in your .module file?
You don't need the ['base'] array as this is to declare new base tables.
You don't want to use a field that's already used by node_views.inc (or whatever file it is). Do you want to make reports.nid available in the view? If so then you want to make it $data['reports']['nid']....
Also both of these don't really do anything but declare a database field with a title, but they're not going to show up anywhere without a filter, field, sort, argument, or relationship array.
You probably only want to display the report_date for a particular node right?
Also, make sure Views caching is turned off while you're testing.