CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Bulk setting a custom field view-only after import
Pages: [1]

Author Topic: Bulk setting a custom field view-only after import  (Read 820 times)

Erich

  • I post occasionally
  • **
  • Posts: 84
  • Karma: 1
Bulk setting a custom field view-only after import
August 06, 2010, 10:14:41 pm
I searched this topic for "SQL connection" but didn't find what I'm looking for (i.e. how to script a SQL connection).

Basically, I have a whole bunch of similarly-defined databases (i.e. the tables and views are the same, the only thing different is the actual data), and in each of these databases I have a set of multiple  custom fields (all in the same field group) that I want to make view-only -- after I have finished seeding the database with imported data.

I am not able to set the field view-only at the time I define the field, because if I do, the import process will not populate the field with data.

I do not have SSH access to the web server, but I do have FTP access (and of course I can run PHP scripts, I just don't know how to write them).

I need to be able to do the following:

for db in <list of databases>
do
  connect to $db
  for label in <list of labels>
  do
    update civicrm_custom_field set is_view=1 where label='$label'
  done
  connect reset
done

Can someone please point me in the right direction?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Bulk setting a custom field view-only after import
August 07, 2010, 08:18:07 am

since u dont know PHP, your best bet is to use PHPMyAdmin: http://www.phpmyadmin.net/home_page/index.php

might be easier and faster

Alternatively, u can use a PHP book / manual to figure out the below

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Bulk setting a custom field view-only after import

This forum was archived on 2017-11-26.