问题
I have two files (App.csv and Acess.csv)
App.csv has one column called Application
Application
App-AApp-B
Access.csv contains 3 columns (Application, entitlement, userid)
Application, entitlement, userid App-A,ent-A,user1 App-A,ent-B,user1 App-B,ent-c,user2 App-B,ent-d,user1 App-C,ent-c,user2 App-C,ent-d,user1
I need extract all the App-A and App-B details if it matches Application file column and output should like be below
App-A,ent-A,user1 App-A,ent-B,user1 App-B,ent-c,user2 App-B,ent-d,user1
i tried using stream-lookup but it's only giving one row per App instead of all rows belongs to App-A and App-B
any help is appreciated
回答1:
I have prepare a solution for you Here
I used user-define-java-class to compare the value.
- RunTrans.ktr: I take app.csv input from here and make data in one row.
- ForOnlyLoop.kjb: This is just for passing data to next transformation.
- CopmareAndResult.ktr: I take access.csv input from here and compare result, if value match then return row otherwise return nothing.
Please let me know if its ok with you.
Another Solution:- You can get same solution using ETL metadata Injection step from Here
- MetaData.ktr:- Take App.csv input and pass value to compare ktr.
- Compare.ktr: Take access.csv input and compare value with 'switch/case' step. I have provided switch- case comparison value from MataData.ktr step.
来源:https://stackoverflow.com/questions/64161359/lookup-pentaho-data-integration