Exercise 1.11 – Use Rules and Events in Mapping

Modified on Fri, 13 Oct 2023 at 06:22 PM

In this exercise, you are going to complete the mapping of the Target Objects in the Business Objects Card and CardStatus (finally...).

You will be using the two Mapping Rules you just created in the last exercise - but also some Mapping Rules already defined in the Target Map by some of your team mates. You will also use the Value Type Identity to assign a unique value to the CardId Target Field.

Finally you are going to use the 2 Events you created even earlier to handle the Flags raised by your new Mapping Rules.

Map the remaining Target Fields in the Target Object Tgt.Card

  • Open Tgt.Card in the Document well, if not open already
  • Map Target Field CardId using the Value Type Identity (see below for an explanation of this Value Type)
  • Map Target Field CardTypeId using your new rule GetCardType and the new Event I0024
    • Select Calculated in Value drop down and select rule GetCardType
    • Map Parameters 
      • BankId to Interface Value Card.BankId
      • CardType to Interface Value Card.CardType
    • Set the Not found flag to Action User Event, and select the Event I0024 you created earlier. The Event comes with the Disposition Full discard, Impact Critical and Receiver Migration, leave these values 
    • As event parameters, map Interface Value Card.CardType
  • Map Target Field CreatedTs using existing rule GetNewTs.
    • Rule GetNewTs
    • Parameters 
      • TsInterval = Literal 4
      • TsDate = Constant TsDate

Now the complete mapping of Target Object Tgt.Card should look like this

  • Save (ctrl-s)

Map the remaining Target Fields in Target Object Tgt.Card_Status.

  • Open Target Object Tgt.Card_Status in canvas, if not open already
  • Map StatusId using existing rule GetCardStatus and new Event I0025
    • Select Calculated in Value drop-down and tab right to open calculated dialog
    • Select rule GetCardStatus
    • Map Parameters 
      • CardStatus = Interface value Card.CardStatus.CardStatus
      • CardActiveDate = Interface value Card.CardActiveDate
      • CardInactiveDate = Interface value Card.CardInactiveDate
    • Handle Flags (both the same)
      • Unknown CardStatus on Card in use and Unknown CardStatus on inactive card
        • Action User Event, select the Event I0025 you created earlier. The Event comes with the Disposition Full discard, Impact Critical and Receiver Migration, leave these values 
        • Event parameters: Interface values Card.CardStatus.CardStatus
  • Map CreatedTs using the existing rule GetNewTs exactly as you did on Tgt.Card above

Now the complete mapping of Target Object Tgt.Card_Status should look like this

  • Save (ctrl-s)

What happened here?

Well, first of all, you completed the Target Field mapping of both your new Target Objects Tgt.Card and Tgt.Card_Status. Congratulations!

And you used the Value Types Identity and Calculated,  so it has been added to your arsenal. The Value Type Guid is not used in these exercises. But it is similar to Identity and explained here.

  • Interface
  • Literal
  • Target
  • Constant
  • Relationship
  • Calculated
  • Identity
  • Guid

Value type Calculated

The Calculated value means that you use a Mapping Rule to calculate the value of the Target Field. So you have brought into use the 2 Mapping Rules you created earlier. And by doing so you also had to handle the Flags your rules can raise. And that made use of the 3 Events you also created earlier tying all these exercises together in a neat little bundle. 

In addition of course you also used some Mapping Rules that your kind teammates (us) had already created.

Value type Identity

is When you use the Value Type Identity on a Target Field, Hopp will at run time assign an Integer value to the Target Field. This value unique for the Target Field. This uniqueness is at run time defined by the values of all the Interface Fields defined as Keys on the Business Object ancestors of the Target Object. In addition, the internal ids of the Target Object and the Target Field in the Target Map are taken into consideration, so the Identity value is globally unique for each Target Field.

The beauty of it is that - for a given Target Field - Hopp will at run time keep assigning the same unique value each time the migration of the same Business Object is iterated. 

Value Type Guid

In addition to the Identity Value Type, the Target Map also provides the Guid Value Type. This Value Type is very similar to the Identity Value Type, but instead of assigning a unique Integer value, it assigns a unique Guid (Microsoft Global Unique Identifier) value to the Target Field

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article