2

I have an instance of drupal 7 installed… and it is storing its data in database A I have then installed CiviCRM… and it is storing its data in database B

I have placed the information shown at sites/all/modules/civicrm/install/index.php in to the settings.php file … so the CiviCRM tables can be seen and found. Also, the base URL is set correctly in the civicdm.settings.php file.

Now when I go to create a view…

  1. I select “Add a view” and specify a name for the view (the view is of type page);
  2. then i select CiviCRM Contacts from the Show drop-down list…
  3. decide on the display format and then click continue and edit to get to the screen to add the fields as required.
  4. On the view creation screen I have added the field CiviCRM Contacts: First Name and that shows correctly with no errors
  5. but when I try adding the CiviCRM Contacts: Contact Sub Type field to the Filter Criteria section (or the Fields section for that matter) I get the following error message:

Error Message states (some info substituted with generic information): SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘<user_which_created_drupal_database>.<drupal_pre-fix>_civicrm_value_<‘civicrm custom field postfix> doesn't exist

By the looks of things, the filter criteria section of the view is looking to the Drupal database for the CiviCRM table for the subtype field - which it obviously won’t find as the table is actually in the CiviCRM database (Database B). A similar situation occurs if I try to add the sub-type field into the 'Fields' sections of the view creation process.

Sounds like this is a configuration issue (E.g Views is looking in the Drupal database and not the CiviCRM database - but yet it does look in the correct database when looking up the Contacts Name) - anyone got any ideas or had this happen to them before, looking for a solution.

3

I think I might have figured out what's going on here... The tables that are trying to be used in the view have been created after the table details were taken from sites/all/modules/civicrm/install/index.php and pasted into the settings.php file (which was done initially when configuring the system). So when the new tables are created they do not exist in the settings.php file (I'm unsure whether CiviCRM should do this by default or not), but if I go in and update the settings.php file with the new mapping it seems to address the issue and Drupal then looks in the correct database.

  • 1
    That's correct. If you create a new custom field set and want to use it in Views then you will need to update settings.php to add the new table. – Aidan Nov 22 '17 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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