Select data based on reference data

Hello KNIMErs,

My today’s challenge refers to selecting subset of data. The simplified example could be described as below.

My sample dataset looks as follows:

I need to select subset of data based on combination of:

List of reference row unique identifiers which is limited to ID2 and ID3

Reference list of strings that is somehow reflected in the names of columns. For the purpose of the example, reference string ‘A’ is reflected in the column names ‘A’ where is a wildcard and reference string ‘B’ is reflected in the column names ‘B’ where is a wildcard.

Sample data could be found in the attached workflow (two tables: data set and reference IDs and strings)

Data_selection.knwf

As a result, I would like to keep data for ID2 row / all ‘A*’ columns and ID3 row / all ‘B*’ columns and present this as a list:

The real dataset contains thousands of rows and hundreds of columns, and reference list could contain thousands of rows. Thus probably loops will be quite slow in execution.

Any suggestions for solution?

Happy KNIMEing!