Tom did a good job of explaining the database structure and following up on this post,getting the data into the database is somewhat a challenging process.

So in putting together the import process, I was trying to get my head around how to create the various xml files to import. Since I am a visual guy, I put this little relationship diagram so I can easily relate my data elements to the example in the documentation xml files of listOfAppType.xml, listOfAppInstance.xml, listOfIDXref.xml, and listOfIDXrefData.xml. (It is a big picture, so click on it and then click on the picture in the window that opens up to see the origina size (at least in IE7))

Some other things to be aware of:

When importing the data, there is the case where you will need to map a BA rule as the following verbiage ‘for input value of A map an X, for value of E map Z for all others map Y’ or you are given the following table:

Incoming value Output Value

AX

BY

CY

D Y

EZ

Since there is the following constraints on the xref_IDXRefData table

CONSTRAINT [IX_xref_IDXRefData_appID] UNIQUE NONCLUSTERED
(
[appID],
[idXRefID],
[appInstanceID]
) ON [PRIMARY] ,
CONSTRAINT [IX_xref_IDXRefData_commonID] UNIQUE NONCLUSTERED
(
[commonID],
[idXRefID],
[appInstanceID]
) ON [PRIMARY]

on either the commonID or the appInstanceID column can’t have a duplicate value. The first work around was to import the data with spaces in the following example

<listOfIDXRefData>
<idXRef name=”Subscriber”>
<appInstance name=”AppInstance_01″>
<appID commonID=”X”>A</appID>
<appID commonID=”Y”>B</appID>
<appID commonID=”Y “>C</appID>
<appID commonID=”Y “>D</appID>
<appID commonID=”Z”>E</appID>
</appInstance>
</idXRef>
</listOfIDXRefData>

In the map I would have the following logic where it would retrieve the appID and I would simply trim the spaces off of the right

However I was unable to import the data using the BTSXRefImport.exe, stating that a key contraint was violated.

I then changed the data to look like this (notice the periods instead of the spaces):

<listOfIDXRefData>
<idXRef name=”Subscriber”>
<appInstance name=”AppInstance_01″>
<appID commonID=”X”>A</appID>
<appID commonID=”Y”>B</appID>
<appID commonID=”Y.”>C</appID>
<appID commonID=”Y..”>D</appID>
<appID commonID=”Z”>E</appID>
</appInstance>
</idXRef>
</listOfIDXRefData>

And in the map I took the first byte of the result of the appID

This worked out great for me except in the following situation

Incoming value Output Value

AXX

BY

CY

D YY

EZ

I first created the following xml structure

<listOfIDXRefData>
<idXRef name=”Subscriber”>
<appInstance name=”AppInstance_01″>
<appID commonID=”XX”>A</appID>
<appID commonID=”Y”>B</appID>
<appID commonID=”Y.”>C</appID>
<appID commonID=”YY”>D</appID>
<appID commonID=”Z”>E</appID>
</appInstance>
</idXRef>
</listOfIDXRefData>

The problem was that I could not just take the right two bytes because that would represent the following table and create a’Y.’ if ‘C’ was sent in.

Incoming value Output Value

AXX

BY

CY.

D YY

EZ

I finally created the final output

<listOfIDXRefData>
<idXRef name=”FirstValue”>
<appInstance name=”AppInstance_01″>
<appID commonID=”X”>A</appID>
<appID commonID=”Y”>B</appID>
<appID commonID=”Y.”>C</appID>
<appID commonID=”Y..”>D</appID>
<appID commonID=”Z”>E</appID>
</appInstance>
</idXRef>
</listOfIDXRefData>

<listOfIDXRefData>
<idXRef name=”SecondValue”>
<appInstance name=”AppInstance_01″>
<appID commonID=”X”>A</appID>
<appID commonID=”Y”>D</appID>
</appInstance>
</idXRef>
</listOfIDXRefData>

I extracted the data, took the first character from each getCommonID resultand then concatonated the values together: