Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Select attribute with wildcard character

avatar
Explorer

Hi,

I am extracting image width and image height using ExtractImageMetadata processor and comparing the Image Width and Image Height with threshold value. If it is greater than the threshold value than I will resize the image. Attribute names, Image Width and Image Height is different for different image formats.

 

e.g. For .png

PNG-IHDR.Image Height
PNG-IHDR.Image Width

 

For .jpg

JPEG.Image Height 

JPEG.Image Width

I want to have a regular expression something like below. So that irrespective of image format, I will be able to compare the Image Width and Image Height.

${"*Image Width":ge(1000):and(${"*Image Height":ge(1000)})}

 

Above regular expression is not working as expected. Any input will be helpful.

 

Thanks and Regards,

Biswa

 

 

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Biswa 

 

NiFi's Expression Language (EL) will not support wildcard in attribute subject names.

I suggest you pull height and width in to a set of standardized attribute names:

Use the UpdateAttribute processor advanced UI to create some rules.  Fore example:
if "PNG-IHDR.Image Height" attribute exists, create new attribute "image height" with value from "PNG-IHDR.Image Height"

Do the same for the other 3 unique attribute names, thus resulting in a static attribute subject names for height and width for use later in your flow for comparison/routing decisions.

Hope this helps,

Matt

View solution in original post

3 REPLIES 3

avatar
Master Mentor

@Biswa 

 

NiFi's Expression Language (EL) will not support wildcard in attribute subject names.

I suggest you pull height and width in to a set of standardized attribute names:

Use the UpdateAttribute processor advanced UI to create some rules.  Fore example:
if "PNG-IHDR.Image Height" attribute exists, create new attribute "image height" with value from "PNG-IHDR.Image Height"

Do the same for the other 3 unique attribute names, thus resulting in a static attribute subject names for height and width for use later in your flow for comparison/routing decisions.

Hope this helps,

Matt

avatar
New Contributor

@MattWho 
would it be possible to share this configuration inside the advanced UI?
I'm having the same problem and I haven't found any way to check if the "Image Height" exists.
Not even a way to get the value.

avatar
New Contributor

I managed to solve the problem.
Below is an example of what I used to get the value of the attributes using the advanced part of the "UpdateAttribute".

mfolco_1-1622517208748.png

 

Hope this helps.