[No Subject]

Objet:   [No Subject] (trouver plus)
De:    
Date:   Dec 07, 2005 20:56

Return-Path: <caché>
Received: by 10.54.133.5 with HTTP; Wed, 7 Dec 2005 11:56:33 -0800 (PST)
Message-ID: <caché>
Date: Wed, 7 Dec 2005 11:56:33 -0800
From: Dave Greenberg <caché>
Reply-To: "CiviCRM: General discussion around development" <caché>
Sender: caché
To: CiviCRM Developer Community <caché>
Subject: Re: [Crm-dev] Tagging several objects simultaneously
In-Reply-To: <caché>
Errors-To: caché
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Delivery-Date: Wed, 07 Dec 2005 14:57:16 -0500
X-Forwarded-To: caché
X-Forwarded-For: caché caché
X-Gmail-Received: 105a99cdc4528de28f7737e9340757b1744946ad
Delivered-To: caché
Received-SPF: neutral (gmail.com: 80.72.33.166 is neither permitted nor denied by best guess record for domain of caché)
DomainKey-Status: bad (test mode)
Old-Return-Path: <caché>
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
 h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
 b=j7F2R12ABPo7L3MpvAFCpk5vX+sARDf5jwO9BNopYoFgmUAWYgiAn04WWXile4myIoTouvESbkO84cqMEiOHhnwGZ9+5O8vXWJfN4o68RafTK0iJBI+X5ERlPERrDhoOZS6NSuSI2Y3pdbt7OHqtjnT/lt0f5TKtmJ2uMfhtdyM=
Content-Disposition: inline
References: <caché>
 <caché>
 <caché>
X-BeenThere: caché
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "CiviCRM: General discussion around development"
 <crm-dev.lists.objectledge.net>
List-Unsubscribe: <http://lists.objectledge.net/mailman/listinfo/crm-dev&gt;,
 <mailto:caché?subject=unsubscribe>
List-Archive: <http://lists.caltha.pl/pipermail/crm-dev>
List-Post: <mailto:caché>
List-Help: <mailto:caché?subject=help>
List-Subscribe: <http://lists.objectledge.net/mailman/listinfo/crm-dev&gt;,
 <mailto:caché?subject=subscribe>
Envelope-To: caché

Hi Greg,

We'll look at solving the UI based import/tagging problem down the
road a bit. I think your idea of allowing folks to assign tag(s) to an
import set as we do w/ Groups is a good one - at least for some use
cases.

For now, you have two choices.
1. We have implemented the Tagging API in 1.3 - so (very soon) you can
use crm_create_entity_tag(&$tag, &$entity) to do this. Details are
here:

http://objectledge.org/confluence/display/CRM/Tagging+APIs

2. You can do this directly in SQL. Sample insert query below -
entity_id is contact ID (civicrm_contact.id) - tag_id is
civicrm_tag.id value for the tag.

INSERT INTO civicrm_entity_tag
(entity_table, entity_id, tag_id) VALUES ('civicrm_contact', 3 3)

BTW - we'd love to hear about the project(s) you're migrating/working on!

..dave

On 12/7/05, Gregory Heller <caché> wrote:
> Dave,
> It seems like the answer here is to create some custom fields that
> correspond to those fields in your source data, do the import, importing
> you"categories" to the custom field, then do a search and tag operation?
>
> I have a similar problem as Joshua.  I am going to be importing about
> 20k records into civicrm.  these records already have "groups" and
> "tags"  In the case of my legacy data, there are actualy "contact type"
> "consituency" and "issue"  so i have 3 types of data that i am going to
> consolidate into civicrm's groups and tags features.  i have 30
> constituencies and 30 issues, and about 18 contact types.
> contact type is s single select field so i am going to map that to group
> on import. (by importing in batches by contact type).
> The consituencies and the issues are going to be the hard ones because
> they are multi select in my legacy data.
>
> since:
>
> ** Tags are stored as a simple join table - entity_id to tag_id
>
> can i interface directly with the database and do an insert into the join table for tags (what is that table called?)
> I would of course first have to create all the tags i want to use, and then match their ids to the entity_ids.
>
> seems to me that you should be able to load a set of contacts and add a tag to them the same way that you can add them to a group.  In that scenario i would do my initial load of all contacts, then just reload subsets for each tag.
>
> -gregory
>
>
> Dave Greenberg wrote:
>
> >Joshua,
> >At some point we'll implement a tagging API which will make this
> >easier/safer. For now, you'll need to create a script for this - and I
> >can give you a headstart...
> >
> >1. You'll need to retrieve the civicrm_contact.id values corresponding
> >to your primary emails using a query like this:
> >
> >SELECT    civicrm_contact.id as contact_id
> >FROM      civicrm_contact
> >LEFT JOIN civicrm_location ON ( civicrm_location.entity_table =
> >'civicrm_contact' AND
> >                                civicrm_contact.id  =
> >civicrm_location.entity_id AND
> >                                civicrm_location.is_primary = 1 )
> >LEFT JOIN civicrm_email    ON ( civicrm_location.id =
> >civicrm_email.location_id   AND civicrm_email.is_primary = 1    )
> >WHERE     civicrm_email.email = '$yourEmailString'
> >
> >2. Browse civicrm_tag to get the id for each tag you want to assign
> >
> >3. Create INSERT query to insert records into civicrm_entity_tag (one
> >for each tag assigned to each contact). Something like
> >
> >INSERT INTO civicrm_entity_tag
> >(entity_table, entity_id, tag_id)
> >VALUES
> >('civicrm_contact', $contact_id, $tag_id)
> >
> >It would be great if you could share your script with the dev list
> >once you have something working. I suspect others will be able to use
> >it :-)
> >
> >Dave
> >
> >
> >On 10/11/05, Joshua Nichols <caché> wrote:
> >
> >
> >>caché wrote:
> >>
> >>
> >>>Input search criteria (basic or advanced search) and click Search
> >>>Select 'Tags Contacts' from the -more actions-  dropdown field
> >>>Change radio button to 'all nnn records' and click Go
> >>>Select the tag to assign
> >>>
> >>>If you still feel you need to do this in SQL or 'outside the
> >>>UI' - let us know.
> >>>
> >>>
> >>Thanks Dave!
> >>
> >>I still see it as useful to be able to do externally, because it's
> >>trivial for me to get a list of everyone in my outlook contacts that are
> >>in the "Clay Monsters" category, but rather awkward, if not impossible
> >>to duplicate that result set using the standard search tools.
> >>
> >>If everything was in only a single category, a careful import would
> >>handle it, but the "Chaotic Evil" category and the "Clay Monsters"
> >>category overlap, but also have non overlapping members.  I don't
> >>necessarily want to re-import the overlapping members just to get the
> >>full set of "Chaotic Evil" folks in after I've already imported the Clay
> >>Monsters.
> >>
> >>
> >>--joshua.
> >>
> >>
> >>
> >>_______________________________________________
> >>Crm-dev mailing list
> >>caché
> >>http://lists.objectledge.net/mailman/listinfo/crm-dev
> >>
> >>
> >>
> >
> >
> >--
> >Best regards,
> >Dave Greenberg
> >CiviCRM Team
> >---------------------
> >Try CiviCRM - http://www.openngo.org
> >_______________________________________________
> >Crm-dev mailing list
> >caché
> >http://lists.objectledge.net/mailman/listinfo/crm-dev
> >
> >
> >
> >
> >
>
> --
> ----
> Gregory Heller
> http://www.CivicActions.com
> http://www.GregoryHeller.com
> AIM/SKYPE: GregoryHeller
>
> The content of this email message is licensed under a
> Creative Commons Attribution-ShareAlike 2.5 License, Some Rights Reserved.
> http://creativecommons.org/licenses/by-sa/2.5/
>
> Get Firefox! The Browser you can trust http://www.mozilla.com
> Reclaim you inbox with Thunderbird! http://www.mozilla.com
>
> _______________________________________________
> Crm-dev mailing list
> caché
> http://lists.objectledge.net/mailman/listinfo/crm-dev
>


--
Best regards,
Dave Greenberg
CiviCRM Team
---------------------
Try CiviCRM - http://www.openngo.org
_______________________________________________
Crm-dev mailing list
caché
http://lists.objectledge.net/mailman/listinfo/crm-dev

Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.