Rules are utilized to assign values to fields. They can target fields in the target map or interface fields in the source map.
There are various types of Rules used at different points, which will be discussed later in more detail.
A Rule has a signature, which means it has a name. It can take zero or more parameters, and it processes the values of its parameters in some way. During processing of the Rule with live data, it may encounter situations where it needs to raise a Flag.
A Rule can raise different types of Flags. Once the Rule has finished processing, it returns a value of a specific type. This is the signature of all rules in Hopp. There are two types of rules: Lookup Rules and Manual Rules.
When using a Manual Rule, you need to provide a name and specify the parameters. For each parameter, you give it a name and specify the data type of the value it will return. You can use a Manual Rule for various purposes, as it needs to be manually implemented in Visual Studio later.
The other type of Rule is a Lookup Rule. Similarly, you need to give it a name, but a Lookup Rule requires a Value Set to function. Once you have identified the Value Set you want to use, you specify the lookup columns within the Value Set that will be used to find a specific row.
Once the Lookup columns are identified, they become the parameters of your Rule. You also need to specify which column should be returned if a row is found. The data type of this column becomes the return type of your rule.
You also need to specify the Flags that the Rule may raise. Finally, you provide the desired behaviour of the Rule, typically in the form of code.
You don't have to implement the Manual Rule immediately. You can continue working with the Rule in Studio as if it were already implemented in the code. Once the Rule is defined, you can start using it in other parts of the mapping.
Behind the scenes, Studio will automatically create two flags for you: one to raise if a row is found and another to raise if a row is not found. You don't have to do anything further along the line.
The code generator will handle the implementation of this Rule for you.
Feel free to watch the accompanying video for a step-by-step explanation of the above article.