Support Questions

Find answers, ask questions, and share your expertise

Get value of variable in Groovy code

avatar
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

avatar
Super Guru

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

avatar
Super Guru

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