Member since
04-12-2019
8
Posts
0
Kudos Received
0
Solutions
01-28-2020
02:49 AM
1 Kudo
@mburgess Matt, thank you so much for your quick response and help. It took me some time to figure out what you meant... but it works like a charm! If anyone can use the solution, here it is: //======================================================================================================
// TEST java LocalDate.parse with groovy max-function
// FF-Attribute RESPONSE contains [{"id":"(1208)", "datbis":"20180219" }, { "id":"(1210)", "datbis":"20191231" }, { "id":"(1212)", "datbis":"20200128" }]
// FF-Atribute MAX_datbis returns 20200128
//======================================================================================================
import java.time.LocalDate
def flowFile = session.get()
if(!flowFile) return
try {
def objList = new groovy.json.JsonSlurper().parseText(flowFile.getAttribute('RESPONSE'))
def max = objList.max {LocalDate.parse(it.datbis,"yyyyMMdd")}
flowFile = session.putAttribute(flowFile, 'MAX_datbis', max.datbis.toString())
session.transfer(flowFile, REL_SUCCESS)
} catch(e) {
log.error("Error while determining max", e)
session.transfer(flowFile, REL_FAILURE)
}
... View more
12-05-2019
04:49 PM
@emanueol as of this writing, I believe that XML attachments aren't allowed, but you can cut and paste the XML source code into the body of a post using the Insert/edit code sample feature of the editor.
... View more