Copy a Data Driven Report Functionality

I am trying to copy the function of a Data Driven Report in SSRS.

I created the below work flow but it sends an email for every instances of a variable.

For example if I have 5 rows of data for the variable it sends 5 emails with all 5 rows of data. But, I only need it to send one row. Not sure how to get the loop to only send one email, can anybody assist with this?

Hi @Shane0513296 , and welcome to the KNIME forum.

I’ve written the following response, but am now wondering if I have fully understood the question. I can’t decide whether you want it to send a single email containing 5 rows, or five emails each containing one row… or one email containing one row… :thinking:

So what I’ve written below is based on my understanding that what you want is for it to send one email for each row, and each email contains only one row of data. (i.e. 5 emails - within one row each). If that’s not the case, let me know and I’ll give an alternative solution.


What’s happening here is that all the rows from you DB Query Reader are being passed to the Row Filter and so, as you say all the rows are being sent with every email.

There are a couple of ways of changing this.

First off, you don’t want the rows from DB Query Reader to go anywhere other than to the Loop start.

So this is one option, in the Table Row to Variable Loop Start you’d configure it so every column from your data becomes a variable, and then you include a Variable to Table Row node, to convert the required flow variables back into a data row, for each iteration of the loop. So on each iteration there is a single row.

Of course, the question then is whether you need to turn everything into a variable and back into a row.

So the opposite approach is this:

Here, the loop processes one row at a time (by configuring the chunk loop to be 1 row per chunk), and then that one row on each iteration is passed to the row filter and onwards through the flow. Meanwhile, the Table Row to Variable node allows you to collect the required variables (if any) that you need for the later processing.

Note: I suspect that you no longer need the Row Filter (as I’m guessing - but don’t know for sure, as I cannot see what it is doing - that you have added that there to try to find a way of filtering the rows to 1 going to the email), in which case, delete the Row Filter and attach the other nodes to the Table to HTML String node instead.

To have it send only a single email, containing a single row. Use my second picture, but keep the row filter and remove the loop start and loop end nodes.

To have it send a single email containing the 5 rows, again use my second picture, remove the row filter, remove the loop start and end nodes. :slight_smile:

Hi @takbb,

I appreciate the help, I don’t think I clearly stated what my end goal was.

Lets say the DB reader pulls this data
image

My end goal is to send one email per Variable in this case John Doe with all the data for John Doe see below data I would want to send
image

as of now my workflow does this however it repeats the process for the number of rows of data I have so for John Doe it send 3 emails with 3 rows of data. But, I need it to send 1 email with 3 rows of data.

and the same goes for the Jane Doe data it sends 2 emails with 2 rows of data.

OK, thanks for the update @Shane0513296,

In this case, you want to do similar to the second picture I put up, but instead of Chunk Loop Start, make it a Group Loop start, and have it group on Email (since you want to send a single email containing the rows related to that email address).

Then have the Table Row to Variable node collect whatever variables you need from the data - it will take these from the first row.

1 Like

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