Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

How to access the updateattributes inside groovy script

avatar
Explorer


I have a custom variable in Updatedate processor( state = success), now i want to access those variable in my groovy script which is in invokescriptor processor.

def status= flowFile.getAttribute('status')

i tried below mentioned both syntax as well

Attemp1:
if( status.equals("success")){
//
}


Attemp 2:
if(status == "success"){

}

the above 2 attempts flowFile.getAttribute('status') returnning null value.

Please correct my mistake!

1 ACCEPTED SOLUTION

avatar
Contributor

You need to provide more information here...Is Updatedate processor an Updateattribute processor? What does invokescriptor processor do? Are you storing an attribute called state or are you using the processor's state?

Assuming its just a variable in flowfile, your attempt 2 should work.

 

Hope this helps. If the comment helps you to find a solution or move forward, please accept it as a solution for other community members.

View solution in original post

1 REPLY 1

avatar
Contributor

You need to provide more information here...Is Updatedate processor an Updateattribute processor? What does invokescriptor processor do? Are you storing an attribute called state or are you using the processor's state?

Assuming its just a variable in flowfile, your attempt 2 should work.

 

Hope this helps. If the comment helps you to find a solution or move forward, please accept it as a solution for other community members.