numeric binner with dynamic interval borders?

Hi Forum,

I have a list (A) of filenames (of product images) that contain a range of rows referring to a second (B) list of products.

List A
imageA 2-4.jpg
imageB 6.jpg
imageC 12-17.png

the numbers are ranges, meaning for example that “imageA” refers to lines 2,3,4 of the second table.
Some “ranges” consist only of a single number, and it it safe to assume that ranges will not overlap.

As a result of my task, the second (product) list should contain an additional column with the valid image file names.

List B (result)
...
01 | product_a | ?
02 | product_b | imageA 2-4.jpg
03 | product_c | imageA 2-4.jpg
04 | product_d | imageA 2-4.jpg
05 | product_e | ?
06 | product_f | imageB 6.jpg
...

I extracted the min/max values from the filenames to separate columns (filling up single values max=min) and my idea is to assign the row numbers of the second table (the product list) to the “bins” from my filenames from list A.
the problem:

  1. the number of files may vary, an as such, the number of intervals, too
  2. I need to define the borders of the intervals according to the min/max values, resulting in completely irregular intervals and also some blank lines, where no image will be assigned.
    Is this possible with a binner node or am I thinking to complicated altogether?
    thanks all!

Hi @roberting

See this workflow that creates a new data file based on your List A (images and borders)
binner_dynamic_borders.knwf (76.7 KB)


gr. Hans

1 Like

Hi @roberting,
I’ve tried to solve the problem with this workflow 20220309_filename_binner – KNIME Hub, but I’m not sure I’ve captured the correct structure of your data

1 Like

Thanks @duristef!
that’s what I hoped to find! But I tried this with the normal numerical binner node and flow variables and got stuck.

thanks @HansS for this solution – I started my workflow just so, but the rest of the solution offers some cool insights to me; I really like the concept of filling up the missing values in opposite directions and comparing the two columns. :grinning:

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.