0

Lets say I have two (mysql) databases drupal and book_data.

The book_data database has a table called books with three columns: isbn, title, pages.

ISBN

My user entity has a field called field_isbn where every user may enter multiple isbn numbers of books he read.

The next step would be to tell views about the books data structure some how.

In the best case views would allow me to add a relationship between the field_isbn and book_data.books.isbn field so I am able to:

  • sum up the pages to see how many book pages a user has read
  • sort/filter for books.title
  • expose theses filters

Is this possible at all?

2 Answers 2

1

I havent done this but I have seen code to make Views in D7 work with remote database tables. If you can get Views to see those tables and fields -- a bit more work should be able to allow you to filter/search through this stuff from Views:

Fields with Multiple Entries in Views w/ External Data Source

It looks like you just have to give drupal a database key for your remote database connection defined in settings.php per field description. The rest looks like a typical implementation of hook_views_data().

0

Establishing a relationship between your users' field and the book entities would definitely be possible, and rather easy with Views - if both the user and book entity where present in Drupal. If you have limitations in which you must store the book data in a separate database, that's O.K., just consider creating an import process in which you convert those books into Drupal nodes with custom fields. That way you will be able to harness all the power that Views relationships have to offer. You can also consider stealing some data import ideas from The Economist's migration to Drupal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.