I am pretty new to Streamsets and I finding it a little confusing and challenging to frame a JSON object inside my Groovy Evaluator object.
I need to frame the below JSON:
{
"filter": "(equals(type,'my/specific/Type') and equals(attributes.number, '1234') and (equals(attributes.status,'ACTIVE'))",
"max": 10
}
I have tried this:
import groovy.json.*
records = sdc.records
for (record in records) {
try {
event = "{"filter": "(equals(type,'my/specific/Type') and equals(attributes.number, '1234') and (equals(attributes.status,'ACTIVE'))","max": 10}"
record.value = event
// Write a record to the processor output
sdc.output.write(record)
} catch (e) {
// Write a record to the error pipeline
sdc.log.error(e.toString(), e)
sdc.error.write(record, e.toString())
}
}
But I receive the below error:
SCRIPTING_03 - Script failed to compile: 'javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1076.groovy: 6: unexpected token: and @ line 6, column 59. uals(type,'my/specific/Type') and equals ^ 1 error '
Kindly help in resolving this.