Member since
06-06-2019
5
Posts
0
Kudos Received
0
Solutions
06-11-2019
06:43 PM
I'm so close with this but afraid I do need a hand with a jolt transformation. I've done most of the work but can't get the last transformation working. I need to have it output without the square brackets. Here is my data: {
"totalElements": 168,
"columns": {
"dimension": {
"id": "variables/daterangehour",
"type": "time"
},
"columnIds": [
"1"
]
},
"rows": [
{
"itemId": "119050300",
"value": "00:00 2019-06-03",
"data": [
120
]
},
{
"itemId": "119050805",
"value": "05:00 2019-06-08",
"data": [
98
]
},
{
"itemId": "119050923",
"value": "23:00 2019-06-09",
"data": [
172
]
}
]
}
}
This is my Jolt: [{
"operation": "shift",
"spec": {
"rows": {
"*": {
"value": "[&1].date",
"data": "[&1].data"
}
}
}
}
] It gives me this result: [ {
"date" : "00:00 2019-06-03",
"data" : [ 120 ]
}, {
"date" : "22:00 2019-06-09",
"data" : [ 307 ]
}, {
"date" : "23:00 2019-06-09",
"data" : [ 172 ]
} ]
This causes my system issues, I actual need the data field like this: [ {
"date" : "00:00 2019-06-03",
"data" : "120"
}, {
"date" : "05:00 2019-06-08",
"data" : "98"
} ] How do I pluck the item out of the array / square brackets? It will only ever be one item in there.
... View more
06-10-2019
09:35 PM
Hello, This is probably a dumb one. I want to send a one off http request as part of my flow each time it runs. I am using invokehttp and I use generateflowfile upstream of it to store the json which is the http request body. The trouble is, the generateflowfile is running thousand times as soon as I turn it on. How can I make it firstly only run once to set the message body?
... View more
06-10-2019
04:42 PM
I am trying to dynamically change the date format of my json file before I send it. import groovy.json.*
def ff = session.get()
if(!ff) return
ff = session.write(ff, {rawIn, rawOut->
//parse flowfile content to maps & arrays
def json = new JsonSlurper().parse(rawIn, "UTF-8")
//change json
json.revision.version = (json.revision.version as Long) + 1
//write to output changed content
rawOut.withWriter("UTF-8"){ it.write( JsonOutput.toJson(json) )}
} as StreamCallback)
session.transfer(ff, REL_SUCCESS) This is the closest I have been able to get by pulling together different tutorials. This is my JSON, this is just one value of data and date but there will be many: {
"test" : [ {
"data" : "119050300",
"date" : "00:00 2019-06-03"
} ]
} How can I use the above script to turn my date into a date time format like this: {
"test" : [ {
"data" : "119050300",
"date" : "2019-06-03'T'10:00"
} ]
}
... View more
- Tags:
- executescript
- json
06-07-2019
06:13 PM
Hello, I'm trying to find the last 1 months worth of data. I need to send my API two dates, the dateFrom and the dateTo. I have this code so far that I found on this forum: ${now() :minus(${now():mod(86400000)}) :minus(2592000000) :format('MM-dd-yyyy hh:mm:ss') }
${now() :minus(${now():mod(86400000)}) :format('MM-dd-yyyy hh:mm:ss') } Which gives this: from 2019-05-08 01:00:00
to 2019-06-07 T01:00:00 What I am confused about it is always shows me 01:00:00 as the time. What I actually want is the last full hour. So if we are at 08:34:54 I want it to show me 08:00:00, so I am always making a complete hourly query. Is there a way to do this?
... View more
06-07-2019
02:01 AM
Hi, I just installed Nifi version 1.92. Its all working fine but there is no GenerateFlowFile processor, or anything like it. A lot of tutorials talk about it. I'm a bit confused about this. Do I need to add it?
... View more
Labels: