Member since
11-01-2017
9
Posts
0
Kudos Received
1
Solution
My Accepted Solutions
Title | Views | Posted |
---|---|---|
1107 | 04-04-2018 10:05 AM |
11-10-2018
08:35 PM
I have done by using executescript processor first I have taken data model { "EntityType": { "Type": "string", "Value": "" }, "EntityName": { "Type": "string", "Value": "" }, "EntityId": { "Type": "string", "Value":"" } inside execute script processor i have written logic for binding our data {"EntityType":"person","EntityName":"Ankit","EntityId":"11"} into this datamodel i am using ECMAScript for this task script :- flowFile = session.get(); if (flowFile != null) { var StreamCallback = Java.type("org.apache.nifi.processor.io.StreamCallback") var IOUtils = Java.type("org.apache.commons.io.IOUtils") var StandardCharsets = Java.type("java.nio.charset.StandardCharsets") flowFile = session.write(flowFile, new StreamCallback(function(inputStream, outputStream) { var text = IOUtils.toString(inputStream, StandardCharsets.UTF_8) var Productiondata = JSON.parse(text) //this is data like key value pair String Datamodel = flowfile.getAttribute("Datamodel"); //taking datamodel from variable for (var defaultData in defaultJsonStrObj) //after that iterating and binding it { defaultJsonStrObj[defaultData]["Value"]=Productiondata[defaultData] } outputStream.write(JSON.stringify(defaultJsonStrObj, null, '\t').getBytes(StandardCharsets.UTF_8)) } })) flowFile = session.putAttribute(flowFile, "filename", flowFile.getAttribute('filename').split('.')[0]+'_translated.json') session.transfer(flowFile, REL_SUCCESS) }
... View more
01-17-2019
07:05 AM
I try this but file split into only one fiile which contain top 3 lines
... View more
04-04-2018
10:05 AM
@Matt Clarke i have solved this issue for plain ftp i have given username as a "anonymous" . so now it is working.
... View more
04-01-2018
04:23 PM
1 Kudo
@ANKIT PATEL Did the answer help in the resolution of your query? Please close the thread by marking the answer as Accepted!
... View more