2

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

4

2 回答 2

3

您可以在 Tableinput 之后使用 MergeJoin。这将合并来自 Mysql 输出行的行,并且您将只有一个 JSON 作为输出...

于 2013-10-15T17:12:34.370 回答
1

您可能希望将合并步骤用于您的目的。不要忘记对输入流进行排序。

注意:在此步骤中,行应按指定的关键字段进行排序。使用排序步骤时,这可以正常工作。当您在 PDI 之外对数据进行排序时,您可能会遇到内部区分大小写/不区分大小写标志的问题

于 2015-08-27T09:24:21.250 回答