Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Get value of variable in Groovy code

Explorer

Hi everyone, I have a problem because I dont know how I can access are all variables (see image) from a script groovy.
Maybe someone want to share some idea in order to solution my problem

PepeClaro_1-1664398448002.png

Regards.

 

1 ACCEPTED SOLUTION

Super Collaborator

Hi,

Based on the link below , it doesnt seem like you can access the variable registry directly from an ExecuteScript processor. You can either use the API - as the referenced article in the link below- to retrieve the value or just use an UpdateAttribute processor to get the value of the variable using Expression Language and store into flowfile attribute before passing it to the groovy script where its easy to retrieve the incoming flowfile attribute.

https://community.cloudera.com/t5/Support-Questions/NiFi-Is-it-possible-to-access-Processor-Group-va...

If that helps please accept solution.

Thanks

View solution in original post

1 REPLY 1

Super Collaborator

Hi,

Based on the link below , it doesnt seem like you can access the variable registry directly from an ExecuteScript processor. You can either use the API - as the referenced article in the link below- to retrieve the value or just use an UpdateAttribute processor to get the value of the variable using Expression Language and store into flowfile attribute before passing it to the groovy script where its easy to retrieve the incoming flowfile attribute.

https://community.cloudera.com/t5/Support-Questions/NiFi-Is-it-possible-to-access-Processor-Group-va...

If that helps please accept solution.

Thanks

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.