Sriranjani Mani, Author at Perficient Blogs https://blogs.perficient.com/author/sriranjanimani/ Expert Digital Insights Tue, 26 Sep 2023 14:26:17 +0000 en-US hourly 1 https://blogs.perficient.com/files/favicon-194x194-1-150x150.png Sriranjani Mani, Author at Perficient Blogs https://blogs.perficient.com/author/sriranjanimani/ 32 32 30508587 Convert Columns to Dynamic Rows in Informatica Using Java Transformation https://blogs.perficient.com/2017/04/10/column-to-dynamic-rows-in-informatica-using-java-transformation/ https://blogs.perficient.com/2017/04/10/column-to-dynamic-rows-in-informatica-using-java-transformation/#comments Mon, 10 Apr 2017 12:07:54 +0000 http://blogs.perficient.com/integrate/?p=3433

Most of us know that the Informatica Normalizer transformation is being used to convert columns into multiple rows. But one of the limitations is that the occur clause in the Normalizer transformation is fixed for all the input rows from the source.

For example, if the requirement is to generate n number of rows for each input record from the  source (where ‘n’ is varying for each input record), then the occur clause in the Normalizer transformation cannot be set/defined dynamically to achieve the goal.

Consider the following input and the expected output result: the below incoming source file has 3 fields – PolicyNum, PolicyHolder and ClaimDetail. The ClaimDetail column has a list of values about the claim number and its claim amount of that policy.

Informatica Normalizer

 

 

 

 

 

 

A policy record should be generated based on the number of claims listed in the claim detail column as the output result.

Informatica Normalizer

 

 

 

 

 

 

By writing a simple java code using Informatica Java transformation, the above scenario can be achieved.

Let’s get started to create a map for this scenario,

  1. In mapping designer, create a mapping and pull the source and target definition into the work area. Here, source and target are comma separated files.
    1. Source properties:Informatica Normalizer
    2. Target properties:Informatica Normalizer target properties
  2. Click Transformation-> Create. Select Java Transformation.
  3. Select the option “Active” when it prompts you for Java transformation type and click Done.
    • Informatica Normalizer
  4. Drag in the input ports from source qualifier to Java transformation.
  5. Open the Java transformation and create 4 output ports – Policy_number, Policy_holder, claim_number and claim_amount.
    • Informatica Normalizer
  6. Move on to “Java code” and click on “ On Input Row” tab and include the below java script
    • String [] column_split;/* declare string array to store the input claimdetail data */ String column_delimiter = “\\|”;

      /* declare string variable to store the delimiter (‘|’) which separates the claim record. Basically, this defines the occur clause. Since ‘|’ is a special character in java regular expression to match any single character, either double backslash ‘\\’ is used before pipe symbol or the pipe can be enclosed within square brackets [|]. In Java, 1) The characters .^$|*+?()[{\ have special meaning outside of character classes. 2) The characters ] ^-\ have special meaning inside of character classes.*/

       

      String [] column_data;

      /* declare string array to store claim number & claim amount */

       

      String data_delimiter = “=” ;

      /* declare string variable to store the delimiter between claim number & claim amount */   

                                                                             

      Column_split = CLAIM.DETAILS.split(column_delimiter);

      /* Using Split function, each claim data is extracted based on ‘|’ delimiter and it has been stored in an array*/

       

      o_POLICY_NUMBER = POLICY_NUMBER ;

      o_POLICY_HOLDER = POLICY_HOLDER ;

      /* Mapping source input ports to java output ports*/

       

      for (int I =0;  i < column_split.length; i++)

      /*Loop begins to generate claim record*/

      {

      column_data = column_split[i].split(data_delimiter);

      /* Using Split function, claim number & claim amount is extracted based on ‘=’ delimiter and it has been stored in an array */

      o_CLAIM_NUMBER = column_data[0];

      o_CLAIM_AMOUNT = Double.parseDouble(column_data[1]);

      /* parser to convert amount value from string to double*/

      generateRow();

      }

       

  7. After including the java code , click on compile to verify that the written code does not throw any errors. If it succeeds, then you can see the statement “ Java Code compilation successful” at the bottom. Apply the changes and click OK.
    • Informatica Normalizer
  8. Drag the java output ports and connect to the target. Validate the mapping and save.
    • Informatica Normalizer
  9. Create a workflow for the above mapping and execute the job. The output result is shown below,Informatica NormalizerHope this helps! I’ll follow up shortly with another interesting blog..!
]]>
https://blogs.perficient.com/2017/04/10/column-to-dynamic-rows-in-informatica-using-java-transformation/feed/ 4 196347
Informatica Mapping Architect for Visio Part – 1 https://blogs.perficient.com/2017/03/31/informatica-mapping-architect-for-visio-part-1/ https://blogs.perficient.com/2017/03/31/informatica-mapping-architect-for-visio-part-1/#respond Fri, 31 Mar 2017 13:08:36 +0000 http://blogs.perficient.com/integrate/?p=3339

(What is it?) Mapping Architect for Visio is an Informatica power center client which is used to create mapping templates using Microsoft office Visio.

(Why?) Mapping templates created using Visio work  as a sketch of PowerCenter mapping which offers reliability and improves efficiency in:

  • Defining principles or rules that determines how specific procedures or methods can be well-defined for data integration projects.
  • Following best practices, standards, and special techniques.
  • Being used as a reusable object for similar mapping code or projects
  • Multiple mapping code can be generated at one shot with the same template
  • Documentation – Mapping template can be used to represent data or process flow while preparing design documents.

Components / Tools of Visio: The Visio provides the following 3 main tools,

Visio

  • Informatica Toolbar:
    1. Creates a mapping template from mapping XML -when the Powercenter mapping export xml is used for template creation.
    2. Validate– The mapping drawing can be verified and validated.
    3. Publish – The mapping template XML file and parameter file is created while publishing the drawing file.
    4. Arrange all button – used to show the mapping objects in best alignment.
    5. Show parameters – Displays the parameters ($<parametename>$) that are created while creating the mapping template which is used to choose/enter the values at the time of importing the template wizard in designer tool.
    6. Declare parameter & variable – Mapping parameters and variables are defined which is denoted as $$<ParameterName>
  • Informatica stencil: Displays shapes that represents mapping objects.
  • Drawing Window – Work area for mapping the template using an Informatica stencil.

Getting started with the mapping Architect for Visio:

1. Mapping Template Creation:

A mapping template can be created in any one of the following ways:

  1. Manual – Mapping template created using Informatica stencils
  2. Importing export XML – A mapping template can be created by importing the existing mapping XML from PowerCenter as a base and can be customized.

Let’s see the first option in detail in this article,

  • Manual Template creation:
  1. Drag the mapping objects from Informatica stencil and create a mapping flow along          with the links between each mapping objects.manual template creation in Vizio
  2. Rules can be configured for each link to designate how data should move from one object to the other object, whether all ports to be moved to the next transformation or any specific fields or key columns to be passed over to the next transformation. Rules can be defined by double clicking on the link object and properties can be configured as per the requirement. By default, the new rule will be all ports.
     Template Creation in VizioTemplate Creation in Vizio
  3. Like the link task, properties of all mapping objects in the drawing panel can be configured  by double clicking on the objects. For example, in the case of multiple mapping generation with the same template, the source and target would be different for each mapping. In this case, the source table and target table can be parameterized and this option will be used to choose the source/target at the time of importing the template wizard. Eg. $SOURCE$ parameter for Source and $TARGET$ for Target object. Template Creation in VizioTemplate Creation in Vizio
  4. Using the show parameter button from the Informatica toolbar, the parameter properties can be set. At the time of importing the template wizard, this set up allows you to choose the source table either in a drop-down fashion (Control =combo box) or in an edit box.Template Creation in Vizio
  5. Using declare parameters or variable can be defined which can be used as a parameter in the mapping and variables in session or workflows. Eg. $$Plan_code parameter, string as datatype.
    Template Creation in Vizio
  6. Once all the rules and parameterization are done, the mapping template should be validated using the validate button from the toolbar.Template Creation in Vizio
  7. Final step is to save the changes to mapping template drawing file.

2. Publish Mapping Template:

When publishing the mapping template, the mapping template XML file and the mapping template parameter file will be generated which are used to generate multiple mappings along with parameter value specification when the import mapping template wizard is used.

After publishing, if there is any update on the mapping template drawing file then it should be re-published.

3. Generation of multiple mappings:

There are two methods to generate mappings in PowerCenter using the mapping template,

  • Mapgen commandline program
  • Import mapping template wizard
Import mapping template wizard option:

To begin with the import mapping template wizard, the basic requirement should be,

  • Mapping cannot be created without source and target in the repository as the template wizard could not access source/target definitions.
  • If in case the shortcuts are used in the templates, then ensure the destination source/target should be available in shared folder in the active repository.

To start with import wizard template,

  1. Open the folder where the mapping will be created in the designer tool
  2. Select the mapping tab and choose the import mapping template option and upload the template XML file and click next when wizard opens.Generation of multiple mappings Vizio
  3. This step is used to specify the parameter values that are defined in the mapping template. In our example, we have created a parameter for source & target ( $SOURCE$ / $TARGET$) with control properties as combo box. So, this step enables us to choose or map the source and target definitions or shortcuts to the corresponding mapping. An alternate option is to opt “use existing” button to make use of mapping template parameter file XML.Generation of multiple mappings Vizio
  4. Clicking the next option twice, the next step will be to click the option ‘Yes’ for the below prompted dialog box. This will export the source and target definitions to tabledef where the PowerCenter client is installed.Generation of multiple mappings VizioGeneration of multiple mappings Vizio
  5. The final step will show the status that the mapping(s) are generated successfully.  In order to generate mappings, enable the check box denoting  “use the workflow generation wizard to create session and workflows for these mapping”. If not, it can be unchecked which prevents workflow generation/creation. The next step will be to click ‘Yes’ for the below prompted dialog box. This will export the source and target definitions to tabledef where the PowerCenter client is installed.Generation of multiple mappings Vizio

Did you find any other enhanced technique for the same perception ? What and how are you implementing them? Let us know in the comments. 

]]>
https://blogs.perficient.com/2017/03/31/informatica-mapping-architect-for-visio-part-1/feed/ 0 196341