0

コンマで区切られたソース フラット ファイルがあり、ファイルには開始日と終了日のヘッダーがあり、次の行にはすべてのファイル名があり、ソース ファイルのデータ例が続きます。

"2015-05-09","2015-06-05"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
"CARRIER ","CONTRACT          ","ELGBL/GRP         ","                  ","TOTAL FEES","TOTAL FEES     ","PMPM ACA    ","PMPM ACA    ","RETAIL      ","RETAIL      ","MEDICAID    ","MEDICAID    ","STATE    ","STATE    ","MAIL SERVICE","MAIL SERVICE","RETAIL      ","RETAIL      ","POSTAGE -   ","POSTAGE -   ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","SYSTEM      ","OTHER       ","OTHER       ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","          
"        ","                  ","                  ","                  ","COUNT     ","AMOUNT         ","METAL       ","METAL       ","DIRECTS     ","DIRECTS     ","            ","            ","HEALTH      ","HEALTH      ","CLAIMS      ","CLAIMS      ","PHARMACY    ","PHARMACY    ","BULK        ","BULK        ","MCRCF       ","MCRCF       ","MCRCP       ","MCRCP       ","MPA         ","MPA         ","MRXC        ","MRXC        ","PPACA       ","PPACA       ","QPC         ","QPC         ","RXSEL       ","RXSEL       ","SPCR        ","SPCR        ","COUNT       ","AMOUNT      ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","          
"        ","                  ","                  ","                  ","          ","               ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","COUNT       ","AMOUNT      ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","            ","          
"1234    ","ABCD5678          ","ABCOEFITEST1      ","                  ","         1","           1.60","       1","           1.60","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       
"1234    ","ABCD5678          ","ABC200074002      ","                  ","         6","           3.20","       2","           3.20","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       4","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       
"1234    ","ABCD5678          ","ABC200178002      ","                  ","         2","           1.60","       1","           1.60","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       1","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       
"1234    ","ABCD5678          ","ABC200197001      ","                  ","         1","           1.60","       1","           1.60","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       
"1234    ","ABCD5678          ","ABC200204002      ","                  ","         2","           3.20","       2","           3.20","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       
"1234    ","ABCD5678          ","ABC200204003      ","                  ","         2","           3.20","       2","           3.20","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       
"1234    ","ABCD5678          ","ABC200232002      ","                  ","         4","           1.60","       1","           1.60","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       3","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       
"1234    ","ABCD5678          ","ABC200300001      ","                  ","         7","           1.60","       1","           1.60","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       6","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       
"1234    ","ABCD5678          ","ABC200345002      ","                  ","         1","           1.60","       1","           1.60","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       
"1234    ","ABCD5678          ","ABC200414001      ","                  ","         9","           3.20","       2","           3.20","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       7","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       
"1234    ","ABCD5678          ","ABC200491003      ","                  ","         1","           1.60","       1","           1.60","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","       0","           0.00","  

だから今、私はそれを1000精度の1つの長い文字列として読んでいます.Java変換を使用して、複数のヘッダーにまたがる列名でそれらを分割し、それらを下の値に関連付けます。1 つの入力行がターゲット行と同じ数になります。

最初に:ファイルを1行ずつ長い文字列ポートに読み込みます。

ソースに「CurrentlyProcessedFileName」ポートを追加して、ファイル名を取得します。
読み取った行数をカウントする

行をコンマで分割します-これをどのように実装しますか?? 式またはJava変換を推測し、Javaで以下のプロセス全体を推測するか、 SP を使用できますか、コンマで行を分割するにはどうすればよいですか??

   If Current RowNumber = 1 Then    
        vINVC_BGN_DT := field1
        vINVC_END_DT := field2

   If Current RowNumber > 1
      If field1 != $$CARRIER Then
    NAME1 := NAME1 || field1  #Initialize NAME variables to an empty string
    NAME2 := NAME2 || field2
    NAME3 := NAME3 || field3  #repeat for each comma seperated field
      If field1 = $$CARRIER Then
    VALUE1 := field1
    VALUE2 := field2
    VALUE3 := field3          #repeat for each comma seperated field

ソース行ごとに、出力行の数は個別の Amount_types の数と等しくなければなりません (空のものを除く)。

   For i in NAME4.NAMEx loop
       if NAMEi is not spaces or null then generate row
           target.INVC_TYPE = "CLAIM"
           target.FILE_RECEIPT_SK
           target.CARRIER := VALUE1
           target.CNTRCT := VALUE2
           target.PBM_GROUP := VALUE3
           target.INVC_BGN_DT := vINVC_BGN_DT  #From row1
           target.INVC_END_DT := vINVC_END_DT  #From row1
           target.INVC_AMOUNT_TYPE := NAMEi
           target.INVC_AMOUNT := VALUEi
   end i loop..
4

1 に答える 1

0

ノーマライザーを使用して、1 つの行を複数の行に分割できます。あなたの場合、最初の行、次の 3 つのヘッダー行、およびデータ行を個別に処理する必要があります。そのためには、変数を使用して式に seq no を作成します。

式自体で開始日と終了日を取得できます。

begin_date:= iif(seq=1, field1, begin_date)

seq>1 && seq<=4ヘッダー行とデータ行を分離するには、とのような条件で rouer を使用します。seq>4

ノーマライザーを使用して、行を複数の行に分割できるようになりました。データ行には、carrier、contract、pbm_group、count、amount の 5 つの列を作成し、count と amount の出現回数を合計数に設定します。またはカウントまたは金額の列。

同様に、ヘッダー列に別のノーマライザーを使用できます。最後に、joiner 変換を使用して 2 つのフローを結合します。

入力行タブで Java 変換を使用することもできます。同様のロジックを記述します。行を分割するには、split メソッドを使用できます。元:

String[] fields=row.split(",");

これで、配列fieldsにはすべてのフィールドが配列要素として含まれます。適切な要素を出力ポートに割り当て、Informatica のgenerateRow()メソッドを呼び出してターゲット レコードを作成できます。

于 2016-04-26T17:39:23.147 に答える