Exercise 1.12 – Create and use a manual Validation Rule

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

It has been determined that it is necessary to validate the values of some of the Interface Fields on the Card Business Object.


CardActiveDate

If a value for CardInactiveDate is provided, a value less than and equal to CardInactiveDate must be provided for CardActiveDate

CardHolderName
A value for CardHolderName should be provided and equal to the name of the Customer using the Card. Warning if different
CardHolderCompanyName
If CardHolderCompanyNumber is provided CardHolderCompanyName must be provided too
StatusEndDate
If a value for StatusEndDate is provided, it must be greater than or equal too the value provided for StatusStartDate


In a real-world Target map it makes good sense to extensively validate Interface Fields in this manner. By exposing problems in the received Interface Fields as early as possible, a wide host of problems in the later processing of the Business Object and its Target Objects can be avoided.


In this exercise, you are only going to deal with CardHolderCompanyName (no 3 above) and leave the rest for your kind team members to sort out.


You are going to create a new Validation Rule and a new Event to use if the rule detects a problem (by raising a Flag) and finally you will use the rule to validate the Interface Field in question.


Create the manual Validation Rule String1ProvidedNotString2

Validation Rules do not return anything, so you will note that you do not need to specify a Returns data type for the new rule.


  • Locate and right-click the folder node Rule -> Validation and select New in the context menu
  • Name the rule String1ProvidedNotString2
  • Provide description: If String1 is provided, then String2 also must be provided, otherwise raise Flag
  • Leave the Rule Type as Manual
  • Specify 2 parameters
    • String1, format Char(*)
    • String2, format Char(*)
  • Specify just 1 Flag
    • 1: String2 is not provided

  • Write an appropriate pseudo-code Specification

If String1 is provided (not null, empty or blank)
If String2 is not provided (null, empty or blank)
Raise Flag 1
end
end

 

  • Save (ctrl-s)

Create a new Event to be fired if the Rule detects a problem

  • Create a new Event 
    • Set the Event Code to 26 (if not already done)
    • Disposition: Retain
    • Impact: Critical
    • Receiver: Migration
    • Text: CardHolderCompanyName is missing on CardHolderCompany ({0})
    • Parameter
      •  CardHolderCompany, format char(10)
    • Save (ctrl-s)



Use new Validation Rule and Event to validate Interface Field Card.CardHolderCompanyName

  • Open Business Object Card and select the Interface tab
  • Select the Interface Field CardHolderCompanyNumber and click the Validation button
  • In the Validation dialog, click the Add button 
    • Select Rule in the first drop-down
    • Select the new Validation Rule String1ProvidedNotString2 in the second drop-down
    • Note that you can have multiple Validation Rule for the Interface Field. The rules will be called in the sequence they appear in the list
  • Provide parameter values
    • String1: Interface field Card.CardHolderCompanyNumber
    • String2: Interface field Card.CardHolderCompanyName
  • Handle Flag String2 is not provided
    • Select Action User Event
    • Select the new Event I0026 CardHolderCompanyName is missing on CardHolderCompany ({0})
  • Provide Event parameter values
    • CardHolderCompany: Interface field Card.CardHolderCompanyNumber
  • Close the dialog by clicking the close button in the Title bar (X)
  • Save (ctrl-s)



What happened here?

You have implemented and used a Validation Rule to validate a certain Interface Field on the Card Business Object. This is just a sample to teach you about Validation Rules. In a real-life project, there will typically be quite a large number of Validation Rules in play.


In addition, you have created a new Event that is fired if the new Validation Rule raises its Flag. And finally, you have used the new Validation Rule to validate the Interface Field Card.CardHolderCompanyName.


Congratulations, you have made it through the Target Map, just a few things left to do. In the next exercise, you will wind things up and get ready to proceed to the Source map.

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