Hi Selvam,

I talked to Bryan and we figured out a way you can do this now. Despite my 
response on the other thread, you don’t even need the *literal* operator to 
accomplish this. I’ve included a link to a template [1] that accomplishes this, 
but the long and short of it is just to compare the attribute “expression” to 
the literal value ‘true' in your RouteOnAttribute. This will compare the String 
‘true’ or ‘false’ to the String literal ‘true’ and return a boolean result. In 
this example I used matched/unmatched, but I also tried an example where I made 
two dynamic relationships and routed on the relationship name, and that worked 
as well. Good luck.

[1] https://gist.github.com/alopresto/e0458804c642339c5bb32dd9a008f2c5 
<https://gist.github.com/alopresto/e0458804c642339c5bb32dd9a008f2c5>


Andy LoPresto
[email protected]
[email protected]
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Oct 7, 2016, at 6:25 AM, Bryan Bende <[email protected]> wrote:
> 
> Selvam,
> 
> I don't believe there is a way to do this right now.
> 
> Your scenario requires two-levels of evaluation... it first needs to evaluate 
> ${expression} to get the value of that, then it needs to do it again to 
> evaluate the resulting expression.
> 
> Currently that is not how expression language works, it only performs the 
> first evaluation and in the case of RouteOnAttribute that needs to return a 
> boolean.
> 
> -Bryan
> 
> 
> On Fri, Oct 7, 2016 at 4:41 AM, Selvam Raman <[email protected] 
> <mailto:[email protected]>> wrote:
> Hi Bran,
> 
> I have an expression in file that have more than 10 condition. I am reading a 
> file using list and fetchs3. Using extracttext i am extracting as attribute 
> (test).
> 
> I am trying to use test in routeonattribute but it shows an error like it was 
> expecting boolean but having string value.
> 
> please let me know if you have any question.
> 
> Thanks,
> selvam R
> 
> Thanks,
> Selvam R
> 
> On Thu, Oct 6, 2016 at 8:57 PM, Bryan Bende <[email protected] 
> <mailto:[email protected]>> wrote:
> Hello,
> 
> I'm not totally sure, but I think this creates two levels of expression 
> language and won't work.
> 
> Typically the flow file would have an attribute like db.table.name 
> <http://db.table.name/> and then in RouteOnAttribute you would define a 
> property like test = ${db.table.name:equals('test')}.
> 
> -Bryan
> 
> On Thu, Oct 6, 2016 at 3:31 PM, Selvam Raman <[email protected] 
> <mailto:[email protected]>> wrote:
> Hi,
> 
> can we refer to an attribute from a previous processor for specifying a 
> boolean clause in routeonattribute processor.
> 
> For Eg. : A flowfile from a previous processor has  a attribute called 
> expression with value ${db.table.name:equals('test')} . Can we refer to this 
> ${expression} attribute as a boolean clause in routeonattribute processor ?
> 
> --
> Selvam Raman
> "லஞ்சம் தவிர்த்து நெஞ்சம் நிமிர்த்து"
> 
> 
> 
> 
> --
> Selvam Raman
> "லஞ்சம் தவிர்த்து நெஞ்சம் நிமிர்த்து"
> 

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to