String Manipulation to write SQL query loop

Hi there,

I need some suggestions on how I can go about this workflow I need:

  • I have one table which contains my data and then I attached it to a String Manipulation Node that I use “substr($Category$,0,3)” in to get the first 3 characters, following by a GroupBy node to give me the different category types:

image

image

I then want to use a String Manipulation Node to write a SQL query to dictate to a DB Query Reader to filter out records that only contains those categories because the dataset is enormous.

The requirement I need is that the first table is dynamic and sometimes the GroupBy will give me 3 results, sometimes 7, sometimes 10. So I feel like I might need some sort of loop to read about many records are in my GroupBy to create the SQL query.

The resulting SQL query would look like from the example above:

Select * from table where cat_type like ‘AIM%’ OR cat_type like ‘ARC%’ OR cat_type like ‘BEC%’ OR cat_type like ‘BEP%’ OR cat_type like ‘BON%’ OR cat_type like ‘CAT%’ OR cat_type like ‘DOG%’ OR cat_type like ‘YEP%’.

But tomorrow when I refresh the workflow, the first table might only have 4 different categories. I want to do this to limit the number of records I need to read in from the DB Query Reader.

This is just an example, the Table Creator is actually reading in from a different database table.

Any suggestions?

Hi @ViTLe

I’m thinking about something like this:

image

gr. Hans

2 Likes