My KTR is: enter image description here

MongoDB Json Input gives the JSON as follows:

{ "_id" : { "$oid" : "525cf3a70fafa305d949ede0"} , "asset" : "RO2500AS1" , "Salt Rejection" : "82%" , "Salt Passage" : "18%" , "Recovery" : "56.33%" , "Concentration Factor" : "2.3" , "status" : "critical" , "Flow Alarm" : "High Flow"}

And one Table input which returns 2 rows:

enter image description here

In StreamLookUp step, Key to look up is configured as asset = AssetName

My final Output is returning 2 jsons:

{"data":[{"Estimated Cost":"USD 15","AssetName":"RO2500AS1","Description":"Pump Maintenance","Index":1,"json":"{ \"_id\" : { \"$oid\" : \"525cf3a70fafa305d949ede0\"} , \"asset\" : \"RO2500AS1\" , \"Salt Rejection\" : \"82%\" , \"Salt Passage\" : \"18%\" , \"Recovery\" : \"56.33%\" , \"Concentration Factor\" : \"2.3\" , \"status\" : \"critical\" , \"Flow Alarm\" : \"High Flow\"}","Type":"Service","DeadLine":"13 November 2013"}]}

{"data":[{"Estimated Cost":"USD 35","AssetName":"RO2500AS1","Description":"Heat Sensor","Index":2,"json":"{ \"_id\" : { \"$oid\" : \"525cf3a70fafa305d949ede0\"} , \"asset\" : \"RO2500AS1\" , \"Salt Rejection\" : \"82%\" , \"Salt Passage\" : \"18%\" , \"Recovery\" : \"56.33%\" , \"Concentration Factor\" : \"2.3\" , \"status\" : \"critical\" , \"Flow Alarm\" : \"High Flow\"}","Type":"Replacement","DeadLine":"26 November 2013"}]}

I want my final JSON output to merge show result something like:

{"data": [{"Estimated Cost":"USD 15", "AssetName":"RO2500AS1", "Description":"Pump Maintenance", "Index":1, "Type":"Service", "DeadLine":"13 November 2013"}, {"Estimated Cost":"USD 35", "AssetName":"RO2500AS1", "Description":"Heat Sensor", "Index":2, "Type":"Replacement", "DeadLine":"26 November 2013"}],

"json":{ "_id" : "525cf3a70fafa305d949ede0"} , "asset" : "RO2500AS1" , "Salt Rejection" : "82%" , "Salt Passage" : "18%" , "Recovery" : "56.33%" , "Concentration Factor" : "2.3" , "status" : "critical" , "Flow Alarm" : "High Flow"}

which means merging 2 rows.

Can anybody help please

有帮助吗?

解决方案

you can use MergeJoin after Tableinput. That will merge the rows from Mysql output rows and you will have only one JSON as output...

其他提示

You would want to use the Merge step for your purpose. Don't forget to sort the input streams.

Note: In this step rows are expected in to be sorted on the specified key fields. When using the Sort step, this works fine. When you sorted the data outside of PDI, you may run into issues with the internal case sensitive/insensitive flag

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top