Skip to main content
leandrolinof
Gold ⭐️
May 18, 2021
Solved

RouteOnAttribute - How to capture property in condition

Good afternoon,

 

I am using the "RouteOnAttribute" processor to do a loop validating a condition that is as follows = ${cont:lt(${CONTADOR})}

 

But I am not able to make the processor understand the property "CONTADOR"

 

Could you help me please?

 

leandrolinof_0-1621364126806.png

 

leandrolinof_1-1621364403404.png

 

leandrolinof_2-1621364435035.png

 

 

 
MattWho
MattWhoAnswer
Titanium ⭐️⭐️⭐️
May 20, 2021

@leandrolinof 

 

NiFi Expression Language (NEL) [1] does not read content of the FlowFile.  The RouteOnAttribute processor never looks at the content of a FlowFile. So verify your source FlowFile has attributes set with valid numeric only values.

So your inbound FlowFile would need to have two attributes on it already:
1. cont

2. CONTADOR


Note: NiFi is case sensitive as well.

And both these attributes need to have assigned values to them.
The NEL statement you have will return the value assigned to the FlowFile attribute "cont" and check to see if it is less than the value assigned to the FlowFile attribute "CONTADOR".    If that resolves to "True", the FlowFile will be routed to the connection containing the new dynamically created "CONTINUE" relationship. Otherwise, it will route to the "unmatched" relationship which you appear to have auto-terminated.

[1] https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html

 

If you found this addressed your query, please take a moment to login and click accept on this solution.
Thank you,

Matt

1 reply

MattWho
Titanium ⭐️⭐️⭐️
MattWhoAnswer
Titanium ⭐️⭐️⭐️
May 20, 2021

@leandrolinof 

 

NiFi Expression Language (NEL) [1] does not read content of the FlowFile.  The RouteOnAttribute processor never looks at the content of a FlowFile. So verify your source FlowFile has attributes set with valid numeric only values.

So your inbound FlowFile would need to have two attributes on it already:
1. cont

2. CONTADOR


Note: NiFi is case sensitive as well.

And both these attributes need to have assigned values to them.
The NEL statement you have will return the value assigned to the FlowFile attribute "cont" and check to see if it is less than the value assigned to the FlowFile attribute "CONTADOR".    If that resolves to "True", the FlowFile will be routed to the connection containing the new dynamically created "CONTINUE" relationship. Otherwise, it will route to the "unmatched" relationship which you appear to have auto-terminated.

[1] https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html

 

If you found this addressed your query, please take a moment to login and click accept on this solution.
Thank you,

Matt

Translate