Skip to main content
PepeClaro
Gold ⭐️
Sep 28, 2022 8:59 PM UTC
Solved

Get value of variable in Groovy code

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.

 

SAMSAL
SAMSALAnswer
Platinum ⭐️⭐️⭐️
Sep 29, 2022 12:10 AM UTC

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-variables/m-p/204283

If that helps please accept solution.

Thanks

1 reply

SAMSAL
SAMSALAnswer
Platinum ⭐️⭐️⭐️
Sep 29, 2022 12:10 AM UTC

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-variables/m-p/204283

If that helps please accept solution.

Thanks

Translate