简体   繁体   中英

INFORMATICA Using transformation to get desired target from a single flat file (see pictures)

I just started out using Informatica and currently I am figuring out how to get this to a target output (flat file to Microsoft SSIS):

    ID     Letter    Parent_ID
   ----    ------    ---------
     1       A         NULL
     2       B          1
     3       C          1
     4       D          2
     5       E          2
     6       F          3
     7       G          3
     8       H          4
     9       I          4

From (assuming that this is a comma-delimited flat file):

c1,c2,c3,c4
A,B,D,H
A,B,D,I
A,B,E
A,C,F
A,C,G

EDIT: Where c1 c2 c3 and c4 being a header.

EDIT: A more descriptive representation of what I want to acheive:

在此处输入图片说明

EDIT: Here is what I have so far (Normalizer for achieving the letter column and Sequence Generator for ID)

在此处输入图片说明

Thanks in advance.

I'd go with a two-phased approach. Here's the general idea (not a full, step-by-step solution).

  1. Perform pivot to get all values in separate rows (eg. from "A,B,D,H" do a substring and union the data to get four rows)
  2. Perform sort with distinct and insert into target to get IDs assigned. End of mapping one.
  3. In mapping two add a Sequence to add row numbers
  4. Do the pivot again
  5. Use expression variable to refer previous row and previous RowID ( How do I get previous row? )
  6. If current RowID doesn't match previous RowID, this is a top node and has no parent.
  7. If previous row exists and the RowID is matching, previous row is a parent. Perform a lookup to get it's ID from DB and use as Parent_ID. Send update to DB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM