Re: Fetch evaluated expression value of a dynamic property

2021-02-05 Thread Ravi Teja Kondisetty
Awesome Mark!

I missed out adding flowFile while calling evaluateAttributexpressions. It
helped me a lot. Thank you very much.

On Fri, Feb 5, 2021 at 9:00 PM Mark Payne  wrote:

> Ravi,
>
> You need to call `PropertyValue.evaluateAttributeExpressions(FlowFile)`.
> So, for example, you’d do something like:
>
> final String myPropertyValue =
> context.getProperty(MY_PROPERTY_DESCRIPTOR).evaluateAttributeExpressions(flowFile).getValue();
>
> You can look at the source code for pretty much any processor that
> supports expression language for more examples.
>
> Thanks
> -Mark
>
>
> > On Feb 5, 2021, at 10:27 AM, Ravi Teja Kondisetty <
> kondisettyr...@gmail.com> wrote:
> >
> > hi folks,
> >
> > I'm building a custom processor where the user can add the necessary
> properties. Now, the properties can be given in expression language. Now
> when I am trying to fetch the property value, it is only fetching the
> actual expression and hasn't been evaluating it. Can someone please throw
> some light on this?
> >
> > Kr,
> > Ravi
>
>


Re: Fetch evaluated expression value of a dynamic property

2021-02-05 Thread Mark Payne
Ravi,

You need to call `PropertyValue.evaluateAttributeExpressions(FlowFile)`. So, 
for example, you’d do something like:

final String myPropertyValue = 
context.getProperty(MY_PROPERTY_DESCRIPTOR).evaluateAttributeExpressions(flowFile).getValue();

You can look at the source code for pretty much any processor that supports 
expression language for more examples.

Thanks
-Mark


> On Feb 5, 2021, at 10:27 AM, Ravi Teja Kondisetty  
> wrote:
> 
> hi folks,
> 
> I'm building a custom processor where the user can add the necessary 
> properties. Now, the properties can be given in expression language. Now when 
> I am trying to fetch the property value, it is only fetching the actual 
> expression and hasn't been evaluating it. Can someone please throw some light 
> on this?
> 
> Kr,
> Ravi