- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Nifi Expression Language: anyDelineatedValue Question
- Labels:
-
Apache NiFi
Created ‎01-17-2018 05:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All
I just have a quick expression language question. Does the anyDelineatedValue return the whole attribute if the delimiter is not present.
example:
number_list = 1000
${anyDelineatedValue("${number_list}, ","):startsWith("1")}
Would the above statement return True?
Created on ‎01-17-2018 12:02 PM - edited ‎08-18-2019 12:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes it returns True as attribute value.
${anyDelineatedValue("${number_list}, ","):startsWith("1")} //split the numbers_list string with ,(based on delimiter) and check any of the number_list values is starting with 1 (or) not.
As we are having just 1000 so number_list string then the expression language check for is the number_list any value is starting with 1 so the result is True.
Example:-
For ${anyDelineatedValue("${number_list}, ","):startsWith("1")}
Case1:-
number_list 1000,2000,3000 result True //because our expression language is checking for any of the delineated values and we are having 1000 which is starting with 1 so returns as True.
Case2:-
number_list 2000,2000,3000 result False //because any of the number list values are not starting with 1 so the result is False.
In Addition
You can evaluate the expression language by using Generate flowfile processor
Configs:-
- Drag and drop generate flowfile processor
- Right click and click on Configure
- In properties tab click on + sign that is highlighted in above screenshot and add new property as
number_list
1000
4.Click on Scheduling Tab and keep Timerdriven with Run schedule as 11111111110 (or) some big number, so the processor trigger 1 flowfile after those many sec that we have given in Run Schedule value.
UpdateAttribute Configs:-
Follow same steps as above and add new property as
ad(your property name)
${anyDelineatedValue("${number_list}",","):startsWith("1")}
After update attribute processor we are going to add ad attribute to the flowfile as result of expression that we mentioned i.e
${anyDelineatedValue("${number_list}",","):startsWith("1")}
Output:-
In above screenshot we are having ad attribute having value as true.
Flow Screenshot:-
Like this way you can test expression language using NiFi.
.
If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of errors.
Created on ‎01-17-2018 12:02 PM - edited ‎08-18-2019 12:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes it returns True as attribute value.
${anyDelineatedValue("${number_list}, ","):startsWith("1")} //split the numbers_list string with ,(based on delimiter) and check any of the number_list values is starting with 1 (or) not.
As we are having just 1000 so number_list string then the expression language check for is the number_list any value is starting with 1 so the result is True.
Example:-
For ${anyDelineatedValue("${number_list}, ","):startsWith("1")}
Case1:-
number_list 1000,2000,3000 result True //because our expression language is checking for any of the delineated values and we are having 1000 which is starting with 1 so returns as True.
Case2:-
number_list 2000,2000,3000 result False //because any of the number list values are not starting with 1 so the result is False.
In Addition
You can evaluate the expression language by using Generate flowfile processor
Configs:-
- Drag and drop generate flowfile processor
- Right click and click on Configure
- In properties tab click on + sign that is highlighted in above screenshot and add new property as
number_list
1000
4.Click on Scheduling Tab and keep Timerdriven with Run schedule as 11111111110 (or) some big number, so the processor trigger 1 flowfile after those many sec that we have given in Run Schedule value.
UpdateAttribute Configs:-
Follow same steps as above and add new property as
ad(your property name)
${anyDelineatedValue("${number_list}",","):startsWith("1")}
After update attribute processor we are going to add ad attribute to the flowfile as result of expression that we mentioned i.e
${anyDelineatedValue("${number_list}",","):startsWith("1")}
Output:-
In above screenshot we are having ad attribute having value as true.
Flow Screenshot:-
Like this way you can test expression language using NiFi.
.
If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of errors.
