简体   繁体   English

使用变换从单个平面文件中获取所需目标(请参见图片)

[英]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): 我刚开始使用Informatica,目前正在弄清楚如何将其获取到目标输出(到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. 编辑:其中c1 c2 c3和c4是标题。

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) 编辑:这是到目前为止我所拥有的(用于实现字母列和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) 执行数据透视以获取单独行中的所有值(例如,从“ A,B,D,H”中获取一个子字符串并将数据并集以获取四行)
  2. Perform sort with distinct and insert into target to get IDs assigned. 执行与众不同的排序并插入到目标中以获取分配的ID。 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? ) 使用表达式变量引用上一行和上一行RowID( 如何获取上一行?
  6. If current RowID doesn't match previous RowID, this is a top node and has no parent. 如果当前RowID与先前的RowID不匹配,则这是顶级节点,并且没有父节点。
  7. If previous row exists and the RowID is matching, previous row is a parent. 如果存在上一行并且RowID匹配,则上一行是父行。 Perform a lookup to get it's ID from DB and use as Parent_ID. 执行查找以从数据库获取它的ID并用作Parent_ID。 Send update to DB. 发送更新到数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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