In this final exercise of the Source Map you are going to finalize the mapping of the Card Business Object Card by mapping its child, CardStatus. The child Business Object CardStatus will be using the new View CardStatus you created in the previous exercise. At a first glance, mapping CardStatus resembles what you already did, when you mapped its parent Business Object Card in a previous exercise. But there is a subtle difference.
If you remember, when creating the Extraction Map for the root Business Object Card, you based the Extractuion Map on the Source Object Src.DebitCard and you had to point out the Break Fields, to tell migFx when to create a new Card Business Object.
Now you will be mapping the child Business Object CardStatus. You still have to add a root Source Object to CardStatus, but now you no longer have to worry about Break Fields. Instead, you must link the child CardStatus to its parent Card. You do that by relating the root Source Object of child CardStatus to a SourceObject in the Extraction Map of parent Card:
On the Relationship you define which Fields on the Source Object Src.DebitCard to use to look for the occurrences of Source Object Vw.CardStatus.
In this exercise you must link CardStatus to the root Source Object on Card - but in other situations it is perfectly alright to link to any child in the Source Map of the parent Business Object.
Let's give it a go!
Relate child Business Object CardStatus to parent Card
- Open the Business Object CardStatus
- In the Extraction Map, click the Add button. Now is the point you will link to the Extraction Map of the parent Card
- In the left part of the dialog, select the Source Object on parent Card to relate to: Src.DebitCard
- In drop down Type to map: Select View
- Finally select CardStatus
Click Ok button to close the dialog
- Select the Selection tab to define the Lookupbetween Src.DebitCard (Parent) and Vw.CardStatus (This)
- This.BankId to Parent.BankId
- This.CardNumber to Parent.CardNumber
- You don't need a Predicate or Predicate Parameters for this Relationship
Relating Src.DebitCard and Vw.CardStatus on BankId and CardNumber will probably result in many Vw.CardStatus for each Sdc.DebitCard. In Discriminator select CardStatusSeqNo to point out that you want a new CardStatus child Business Object for each distinct value of CardStatusSeqNo (of course, it is really each distinct value of BankId, CardNumber and CardStatusSeqNo combined, but migFx takes care of this).
Note that you can use the Discriminator to decide in which order the child Business Objects are created.
Again, use the Selector in case there are more than one row on Src.DebitCard for a given Discriminator. The Selector will tell the Source Engine which row to pick. In this exercise, it is not necessary to specify anything
Your have now finished the Relationship and it should look like this:
Map the Target Interface Fields
Left is only to assign values to the Target Interface Fields of CardStatus. All the field can be give an Source value, so this is very easy and straight forward;
- Select tab Export, sub-tab Target Interface
- Assign these Source values
- CardStatusSeqNo: Vw.CardStatus/CardStatusSeqNo
- CardStatus: Vw.CardsTatus/CardStatus
- StatusStartDate: Vw.CardStatus/CardStatusStartDate
- StatusEndDate: Vw.CardStatus/CardStatusEndDate
- Save and Check in
What happened here?
You have now finished the chain of exercises prepared to introduce you to the Source Map. You have seen how the Interface exposed by the Target Map is presented to you in the Source Map as the task to perform: Assign the values for all the Target Interface Fields in the Business Object hierarchy.
To do this you relate each Business Object to metadata structures in the Source System by creating Source Objects in the Extraction Map of each Business Object - thereby gaining access to the Source Fields of each of these Source Objects.
Furthermore, you have seen how you can use Views to 'pre-process' the data delivered by the Source System, a very powerful facility that allows you to clean, transform and aggregate data from the Source System. You have also created the relation that constitutes the bridge from a parent Business Object to its child Business Object.
A heady mouthful, but we hope you got the idea along the way.
Before finishing up this part of the exercises, there is just one more aspect of the Source Map to mention - not to worry, this bit is for information only. There is no exercise behind it and you should not change anything in your Source Map.
Business Object copy
The Business Object hierarchy given by the Target Interface published from the Target Map and is strongly founded on the Target System. This is fully intentional, after all it is the Target System that will be continuing, that everybody have to live with hereafter. So if any compromises have to be made, it is preferable that these happen in the Source Map founded on the Source System - that for all extents and purposes is going away.
That being said, something that is one logical unit in the Target System - and defined as one Business Object hierarchy - may not be stored in the Source System in the same way. For instance, what may be the all-encompassing Account Business Object in the Target System could very well be separated in the Source System into for instance Current Account, Portfolio Account, Guarantee etc. Each of these will have to deliver data to the same Target Interface for Account, but may have to extract data from the Source System in vastly different ways.
Enter the Copy function in the Source Map - Tadaa! At any level - root level or somewhere down in the child hierarchy - you can copy a Business Object. By doing so, the copy will still be delivering the data to the same Target interface, but now you can build Extraction Maps in the copied Business Objects that are completely different.
Once you make a copy, you must name it - and it is a good idea to name the original as well. Given the example above, in the Source Map you would create 2 copies of Account and afterwards name each of the 3 copies Current, Portfolio and Guarantee. Once you have done that, the 3 copies will forever after everywhere in migFx (Studio, Director and Tracker) appear like so:
- Account [Current]
- Account [Portfolio]
- Account [Guarantee]
To copy a Business Object in the Source Map, you simply right-click it in the Project Explorer tree view and select Copy in the context menu. In the following dialog you can choose either to create an empty copy or to include the mapping: All Extraction Maps and all value assignments for the Target Interface.
You can read more about Business Object Copy here.
That's it - bye, bye from the Studio related exercises.