Macros in IICS
Informatica IICS: An expression macro is a useful technique for creating complex or repeating expressions in mappings. This makes it possible to perform computations over various fields or constants.
creating a collection of related expressions so that the same computation can be done on several input fields.
Steps to Use Macros:
- Login into your informatica cloud account and open Data Integration microservice.
- Now, create a new mapping by clicking on New from Navigation window and Select Mapping and click on create.
- Select source and target Objects in Source and Target Transformations.
- Now, Create an Expression Transformation in IICS mapping between Source and Target.
- Click the “+” icon in Expression Transformation to create an input macro field. Then, choose “Input_Macro_Field” as the field type, as shown below.
- Configure the port according to the requirements (that is, whether we wish to apply the same logic or condition to all fields or just a few specific fields) as indicated below after generating the input macros.
- Create an additional field in the same way as before, but this time choose “Output_Macro_Field” as the field type for the output macro, choose the data type, and set the precision to “Max” in order to avoid data truncation, as shown below..
- Configure your macro expression in the output macro.
- For example, we had to apply the LTRIM RTIM function and set all blank values to null. However, attempting to validate this expression resulted in an error: ‘This expression cannot be validated because it uses macro input fields’ . So, avoid from clicking the Validate button.
- Navigating to the target, you will see an additional incoming field from the expression “%Input_Macro%_out.” As shown below.
- In Target Transformation, choose ‘Completely Parameterized‘ under field mapping, and then create a new parameter as indicated below.
- Now save the mapping.
- Create a Mapping Configuration Task (MCT) and Select Runtime Environment and click Next .
- Map all the fields with the suffix “_out” in order to allow expression logic to be applied in expression macros as shown below.
- Click “Finish” and run MCT to complete the mapping requirements.