Support Questions

Find answers, ask questions, and share your expertise

Nifi Expression Language: anyDelineatedValue Question

avatar
New Contributor

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?

1 ACCEPTED SOLUTION

avatar
Master Guru

@Richard Scott

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:-

51412-generateflowfile.png

  1. Drag and drop generate flowfile processor
  2. Right click and click on Configure
  3. 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:-

51413-update.png

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:-

51414-output.png

In above screenshot we are having ad attribute having value as true.

Flow Screenshot:-

51415-flow.png

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.


generateflowfile.png

View solution in original post

1 REPLY 1

avatar
Master Guru

@Richard Scott

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:-

51412-generateflowfile.png

  1. Drag and drop generate flowfile processor
  2. Right click and click on Configure
  3. 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:-

51413-update.png

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:-

51414-output.png

In above screenshot we are having ad attribute having value as true.

Flow Screenshot:-

51415-flow.png

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.


generateflowfile.png