SRC:
we have source data as below, we have multiple products under one category and products are delimited by comma (,).
TGT:
we need to show output as below using Informatica PowerCenter.
Solution:
Assumption: we can have maximum of 4 products under one category.
Below is the data flow
Used reg extract to divide product names into individual product names in 1st expression transformation.
Below are the expressions that I have used:
P1 | to | REG_EXTRACT(PRODUCTS,'((\w|\s)+),*((\w|\s)*),*((\w|\s)*),*((\w|\s)*),*((\w|\s)*)',1) |
P2 | to | REG_EXTRACT(PRODUCTS,'((\w|\s)+),*((\w|\s)*),*((\w|\s)*),*((\w|\s)*),*((\w|\s)*)',3) |
P3 | to | REG_EXTRACT(PRODUCTS,'((\w|\s)+),*((\w|\s)*),*((\w|\s)*),*((\w|\s)*),*((\w|\s)*)',5) |
P4 | to | REG_EXTRACT(PRODUCTS,'((\w|\s)+),*((\w|\s)*),*((\w|\s)*),*((\w|\s)*),*((\w|\s)*)',7) |
Use normalizer transformation to convert these columns to rows and use filter transformation to filter out null products. (Filter condition: PRODUCTS<>'')
It worked for me, let me know if you face any issue.
No comments:
Post a Comment