Exporting Raiser's Edge for CiviCRM » History » Version 23
Jon Goldberg, 08/14/2014 01:23 PM
1 | 1 | Jon Goldberg | h1. Exporting Raiser's Edge for CiviCRM |
---|---|---|---|
2 | |||
3 | 23 | Jon Goldberg | There are two basic approaches to exporting RE data. There's the built-in export tool, and there's direct SQL interaction. This document will try to cover both approaches where possible. The Export tool has a lower barrier to entry, but a) there's some data you can't export with the tool, and b) the data will be denormalized, requiring additional transformation compared to extracting normalized SQL data. |
4 | 1 | Jon Goldberg | |
5 | 23 | Jon Goldberg | h2. Export tool - general guide. |
6 | |||
7 | The Raiser's Edge Export tool is on the left toolbar when you first enter Raiser's Edge. |
||
8 | |||
9 | 1 | Jon Goldberg | From the tool, you will create a number of exports. When you first create an export, you'll be asked a number of questions, including Export Type (Constituent, Gift, etc.), a checkbox to include inactive records (check this), and an export file type (select CSV). |
10 | |||
11 | 23 | Jon Goldberg | For most export, select Constituent as the Export type. This is the "base table" - all records will be joined relative to it. |
12 | 3 | Jon Goldberg | |
13 | 1 | Jon Goldberg | h2. Constituent Based Exports |
14 | |||
15 | 21 | Jon Goldberg | h3. Contact Information |
16 | 1 | Jon Goldberg | |
17 | 23 | Jon Goldberg | RE differentiates between constituents and non-constituents in their system. If you create a new contact, they're a constituent - but then you might decide to add a spouse or employer record, which is NOT considered a constituent, and doesn't show up in most queries. Notably, non-constituents aren't exported when using the Export tool and your base table is "Constituent". |
18 | 1 | Jon Goldberg | |
19 | 23 | Jon Goldberg | h3. SQL |
20 | |||
21 | 1 | Jon Goldberg | If extracting directly from SQL, @SELECT * FROM RECORDS@. |
22 | 21 | Jon Goldberg | |
23 | 23 | Jon Goldberg | Note that you can extract only constituents by adding @WHERE IS_CONSTITUENT = -1@. For a Civi migration, I recommend importing all contacts. |
24 | 21 | Jon Goldberg | |
25 | 23 | Jon Goldberg | h3. Export tool (NOTE: This ONLY gets constituents). |
26 | |||
27 | 1 | Jon Goldberg | Tab 1. General: |
28 | - Include all records. |
||
29 | - Head of Household processing: Export both constituents separately. |
||
30 | - Check all of the "Include these Constitutents": Inactive, deceased, no valid address |
||
31 | |||
32 | Tab 2: Output. |
||
33 | First, expand the "Constituent Information" in the left pane, and add every field to the export. Do the export (as a CSV). |
||
34 | 6 | Jon Goldberg | |
35 | 3 | Jon Goldberg | h3. Constituent Codes |
36 | 15 | Jon Goldberg | |
37 | 19 | Jon Goldberg | In RE: Found at the bottom of the "Bio 2" tab. |
38 | In SQL: CONSTITUENT_CODES maps to "GroupContact". TABLEENTRIES stores the codes ("groups"). In my case, @SELECT * FROM [CCR_July_snapshot].[dbo].[TABLEENTRIES] WHERE [CODETABLESID] = 43@ did the trick. YMMV - see "deciphering stored procedures" below. |
||
39 | 3 | Jon Goldberg | |
40 | 1 | Jon Goldberg | Export as _one to many_, below. |
41 | 3 | Jon Goldberg | These map to "groups" in Civi - can also be mapped to "tags" if you don't need to track the begin/end date on them. |
42 | |||
43 | No need to export these fields: |
||
44 | System Record ID |
||
45 | Import ID |
||
46 | 23 | Jon Goldberg | As of Civi 4.4.6, there's no way to import Group Begin/End dates via API, you need to do it via direct SQL. |
47 | 6 | Jon Goldberg | |
48 | h3. Solicit Codes |
||
49 | |||
50 | Export as _one to many_, below. |
||
51 | These can map to groups - but also may map to privacy preferences or custom fields (e.g. Email Only, Do Not Solicit) |
||
52 | Export the "Solicit Code" only (along with the Constituent's System Record ID, of course). |
||
53 | 3 | Jon Goldberg | |
54 | 20 | Jon Goldberg | h3. Addresses |
55 | |||
56 | SQL tables: ADDRESS, CONSTIT_ADDRESS |
||
57 | |||
58 | Addresses are a many-to-many relationship in RE. |
||
59 | |||
60 | 22 | Jon Goldberg | h3. Phones and E-mail |
61 | |||
62 | RE is a children of the 90's, so a) phones are tied to addresses, not contacts, and b) e-mails are a type of phone. |
||
63 | |||
64 | This SQL gets me a useful list of phones and e-mail for further processing in Kettle: |
||
65 | <pre> |
||
66 | SELECT DISTINCT |
||
67 | CONSTITADDRESSID |
||
68 | , CONSTIT_ID |
||
69 | , PHONETYPEID |
||
70 | , CONSTIT_ADDRESS_PHONES."SEQUENCE" |
||
71 | , NUM |
||
72 | , DO_NOT_CALL |
||
73 | , TEXT_MSG |
||
74 | FROM CONSTIT_ADDRESS_PHONES |
||
75 | LEFT JOIN PHONES ON CONSTIT_ADDRESS_PHONES.PHONESID = PHONES.PHONESID |
||
76 | LEFT JOIN CONSTIT_ADDRESS ON CONSTITADDRESSID = CONSTIT_ADDRESS.ID |
||
77 | </pre> |
||
78 | |||
79 | 9 | Jon Goldberg | h3. Relationships |
80 | |||
81 | Relationships are different in Civi and RE in the following significant ways: |
||
82 | * Relationships don't have to have a relationship type. |
||
83 | * The A-B relationship doesn't have to have the same relationship type as B-A (e.g. if my relationship is "parent", the reciprocal relationship could be "son" or "daughter". |
||
84 | * Most importantly, related contacts need not have their own constituent record (though they can). If they don't have their own constituent record, they nevertheless have a record, just not one that's available from within the normal queries/lookups. |
||
85 | |||
86 | 10 | Jon Goldberg | h3. Attributes |
87 | |||
88 | Attributes are the RE equivalent of custom fields. However, unlike custom fields, they can also have a "date" value and a "comments" value. While this can be replicated in Civi via multi-record custom field groups, ideally the data is evaluated attribute by attribute. |
||
89 | |||
90 | 11 | Jon Goldberg | Valuable information about the setup of the attributes is available in RE from *Config > Attributes*. |
91 | 1 | Jon Goldberg | |
92 | 11 | Jon Goldberg | *note:* I'm currently evaluating the use of CiviCRM 4.5+'s "EntityRef" functionality to facilitate chained selects of OptionValue lists. If this is successful, that would facilitate creating a single multi-record custom field group (with the fields "Attribute", "Description", "Date", "Comments") that would work VERY similarly to how RE handles attributes. |
93 | 10 | Jon Goldberg | |
94 | 3 | Jon Goldberg | h3. Other constituent tables: |
95 | 5 | Jon Goldberg | |
96 | 2 | Jon Goldberg | Skip these tables: |
97 | * Spouse |
||
98 | * Gifts |
||
99 | * First Gift, Last gift, Largest Gift |
||
100 | * Actions |
||
101 | 1 | Jon Goldberg | * First Action, Last Action |
102 | * Summary Information |
||
103 | |||
104 | 7 | Jon Goldberg | h3. Tables that Civi doesn't have a direct counterpart for |
105 | 5 | Jon Goldberg | |
106 | 3 | Jon Goldberg | * Aliases (stores Maiden Name and d/b/a - unsure how to import into Civi just yet) |
107 | 7 | Jon Goldberg | * Solicitor Goals - Can be found on an RE contact record on "Bio 1" tab by clicking "Details" next to "Is a Solicitor" checkbox. Don't know how to use them. |
108 | 2 | Jon Goldberg | |
109 | |||
110 | Open each CSV file in Excel or similar. Sort each field by ascending AND descending to see if any data is stored in that field. If every record has no data or the same data, delete it - it's not being tracked in the current system. If you see only one or two records with a particular field, they're also probably fine to go, but check with the client first. |
||
111 | |||
112 | 1 | Jon Goldberg | |
113 | Next, strip out all of the constituent information except for primary/foreign keys. I like to keep in First/Middle/Last name just for human readability though. So leave in those three fields, plus any field with the word "ID" in it. This is your base constituent info, and will be in every other export you do. |
||
114 | |||
115 | Now comes the fun part! Export each table, one at a time, by adding those fields to an export that already includes the base constituent info. |
||
116 | |||
117 | For one-to-many relationships, the system will ask you how many instances of the information to export. I default to 12, then look over the data to see how many are actually used, then re-export with a higher or lower number. |
||
118 | |||
119 | I also remove records that don't contain the relevant data. For instance, when exporting Solicit Codes, I sort by the first Solicit Code. Then I scroll down past the folks that have Solicit Codes to those who have none, and delete the rows for folks who have none. |
||
120 | |||
121 | Note that for simplicity's sake, RE contains many views of the tables that, if you export them all, you'll have redundant data. There's no need to export "First Gift", "Last Gift", or "Largest Gift" - simply export all gifts. Likewise for "Preferred Address". |
||
122 | |||
123 | When exporting one-to-many tables that themselves contain one-to-many tables (e.g. Addresses contains Phones), do NOT select 12 of each! That means you're exporting 144 phone numbers per record. First determine the maximum number of addresses being tracked, re-export with that number, THEN export with phone numbers. Also, it's reasonable to export with 5 phone numbers per address. |
||
124 | |||
125 | NOTE: Letters sent is incomplete, there's more than 12 letters to some folks! |
||
126 | |||
127 | GIFTS is related to constituent on the last column (Constituent System Record ID) |
||
128 | 8 | Jon Goldberg | |
129 | 13 | Jon Goldberg | h3. Code Tables/Option Groups/Option Values |
130 | |||
131 | 17 | Jon Goldberg | If you're extracting data from the SQL back-end, you'll see that the RE equivalent to Civi option groups is "code tables". There's two functions that handle lookups: dbo.GetTableEntryDescription and dbo.GetTableEntryDescSlim. To determine where the data is being accessed by the function, see "Deciphering MS SQL", below. Use the "lTableNumber" passed to those functions and you'll find your data in dbo.CODETABLES (comparable to civicrm_option_group), dbo.CODETABLEMAP and dbo.TABLEENTRIES (comparable to civicrm_option_value). |
132 | |||
133 | h2. Deciphering MS SQL |
||
134 | |||
135 | SQL Server Profiler is a tool that lets you spy on SQL statements passed to MS SQL, which is good for determining where certain data lives. However, RE depends on functions and stored procedures, so sometimes the SQL won't tell you exactly where to look. |
||
136 | |||
137 | h3. Looking Up Functions |
||
138 | |||
139 | These are embedded in SQL and have a nomenclature like: dbo.GetTableEntryDescSlim. Find them in SQL Server Management Studio: database > Programmability > Functions > Scalar-valued Functions. |
||
140 | |||
141 | h3. Looking Up Stored Procedures |
||
142 | |||
143 | 18 | Jon Goldberg | If, in the profiler, taking a certain action shows a command like this: |
144 | 17 | Jon Goldberg | These have a syntax like: |
145 | 1 | Jon Goldberg | <pre> |
146 | 18 | Jon Goldberg | exec sp_execute 48,43,'Acknowledgee' |
147 | 1 | Jon Goldberg | </pre> |
148 | |||
149 | 18 | Jon Goldberg | You're dealing with a stored procedure. You need to find the corresponding @exec sp_prepexec@ command (in this case, the one with a 48). In this case, it looks like: |
150 | <pre> |
||
151 | declare @p1 int |
||
152 | set @p1=48 |
||
153 | exec sp_prepexec @p1 output,N'@P1 int,@P2 varchar(255)',N'SELECT Top 1 TABLEENTRIESID FROM DBO.TABLEENTRIES WHERE CODETABLESID = @P1 AND LONGDESCRIPTION = @P2 ',43,'Acknowledgee' |
||
154 | select @p1 |
||
155 | </pre> |
||
156 | |||
157 | 17 | Jon Goldberg | |
158 | 13 | Jon Goldberg | |
159 | 14 | Jon Goldberg | h3. Addressee/Postal Greeting/E-mail greeting |
160 | |||
161 | RE has a much wider variety of greeting formats out-of-the-box. The "spouse ID" is stored on the record to enable quick lookups of addressee greetings that include the spouse. |
||
162 | |||
163 | 8 | Jon Goldberg | See also: |
164 | http://support.littlegreenlight.com/kb/migration/migrating-from-the-raisers-edge-to-lgl |
||
165 | 14 | Jon Goldberg | |
166 | h3. Things I see that RE does better than Civi: |
||
167 | |||
168 | * Better greetings/salutations UI out of the box. In Civi, you must in-line edit the greetings, then press "Edit" next to the greetings, and even then you only see the tokens you'll use. RE lets you edit with no clicks, and parses the tokens for you. |
||
169 | * The equivalent of option values are stored with their id, not their value. This isn't a big deal, but it DOES make data transformation easier in RE, and I suspect it makes their equivalent of pseudoconstant code easier to read. |