connect multiple nodes to variable loop end node

Hi Knimers,

Hope every one are safe.

I would like to connect multiple nodes to variable loop end, but not able to do it. I think its better to explain the entire process (bit lengthy though).

I have an excel file with some data, need to split the data, create excel files and send emails with attachment based on user name column. Each file should consist of 3 sheets (2 data sheets and 1 summary sheet). The data sheets are created based on of the column filters. For example if column “abc” has T&E, all rows pertaining to T&E should be written in sheet 3, otherwise it should write in sheet 2 and the summary is a combination of formulas (count of volume, sum of amount, average of aging along with graphs) of respective categories for Status column (screen shot as mentioned below).

I was able to build the workflow till writing the data to sheet2 and sheet3, below is the screen shot for your reference.

I assume that if we have a excel template with all the above sheets(Summary, Sheet2 & Sheet3) and KNIME writes the data into respective 2 sheets and summary pics the values using excel formulas automatically and save the file as with variable created with in the loop. Not sure how this can be achieved.

you can provide your comments/suggestions whether my approach is in the right way or any change is required.

Any helping hand is much appreciated.

Regards,
Pavan

Hi @pawanmtm

I believe you were almost :wink: !

  • If the Excel file has never been created (or it needs to be created from scratch) then you need to use the Excel writer the first time. Make sure that overwrite option is set in the Excel Writer node if this is fine with you.
  • If the Excel file already exists, then using an Excel Sheet appender as first Excel node is also fine.
  • Once the Excel file exists, you can append sheets, but it is wise to make sure that they are written sequentially to avoid unexpected results or even prevent the workflow to crash.

In your workflow, execution of the three Excel nodes can happen in any order (even the first one " missing LEQR file" could run after the supposed last one “write to Sheet3”).

To make it to be sequential, a “directed” path needs exist to define a relation of order, for instance as shown in the amended image below:

Besides this, there is perhaps an issue with your first “row filter” node that is connected at the same time from inside and outside the loop start. Not sure whether this is a second issue in your case with respect to the results you want eventually to obtain.

Hope these few hints are of help.

Best regards

Ael

5 Likes

Hi @aworker,

Thanks for your time and input, with little modification as suggested by you, i was able to write the data to sheet2 and sheet3 as desired( loop through).

Now the challenge is how to create the summary sheet from both the data sheets as mentioned in my 1st screen shot as it involves multiple excel formulas and 2 charts/graphs.

Regards,
Pavan

Hi All,

I have taken the approach of writing the data to respective sheets of a fixed file (name), then try save as the file with the output of create file name node variable, used merge variable node and looped it. Thought it is no errors, the files are not created, however output of the variable loop end shows as all the files are created, not sure where i am missing or is this correct way of doing it.

could some one assist on this.

Regards,
Pavan

Hi,

Just wondering if someone got a chance to look into and assist.

Regards,
Pavan

Hi Pavan

Could you post your workflow (with non confidential data) ? This would make easier for people to help you.

I believe that providing a global solution to your request is more involved than it looks like, specially because of the final format of your Excel files that contains images and different tables. You most probably will need to have a look at Continental nodes for the formating :

https://www.knime.com/community/continental-nodes-for-knime

Alternatively, you can investigate a Birt solution to generate your Excel reports, but this also requires a bit of previous experience:

https://docs.knime.com/latest/report_designer_user_guide/index.html

Hope these few hints are of help.

Best regards,

Ael

2 Likes

Hi Ael,

Let me provide some dummy data with workflow and in the mean while i will also go through the links provided by you.

Regards,
Pavan

1 Like

Here is the workflow, data and the desired output files attached for reference.

Hope this provide more clarity on my requirement.

Please let me know for any additional information on this.
Data.xlsx (17.5 KB)
Recipient Name.xlsx (22.5 KB)
User Wise Report test.knwf (228.5 KB)

Regards,
Pavan

Hi @pawanmtm,

Not sure what exactly your goal is, but you are writing to the same file and the same sheets in all iterations.

You are not using the path created by the Create File Name node.

:blush:

2 Likes

Hi Armin,

My aim is to create multiple files based on the create file name node with all the 3 sheets (summary, p2p queries and t&e queries) each.

Since the creation of summary sheet is complicated in KNIME, i have created a template with the excel where KNIME writes the data into P2P Queries and T&E Queries sheets and Summary sheet populate the required data and graph automatically using excel formulas. This template should be saved as with the variable created by the create file name node. This should repeat for all the files.

Hope this helps in understand the requirement better.

Regards,
Pavan

So you have to pass the variable to the flow where it goes to the writer nodes and then set the output file location by using the variable.

:blush:

1 Like

Hi Armin,

I was able to do it by using the below workflow. However i am missing the summary sheet.

Regards,
Pavan

Just wondering if someone has any luck on the above requirement.

Regards,
Pavan

Hi,

If I correctly understand your problem you have an excel file like a template for your report Template.xlsx (14.4 KB) and an excel file with some data Data.xlsx (8.8 KB) to process in KNIME. Then the result is written back to the template for every group (in my example users) so you need n files (based on the template) one for each group (User1.xlsx (11.6 KB), User2.xlsx (11.7 KB) and User3.xlsx (11.7 KB).

I have started with making n copies of the template file (one for each group) and then copy the manipulated data into each file (created before) separately as a new sheet based on user and filename.

Look at this workflow for some idea
User report.knwf (102.7 KB)

I hope it will help you in some way

3 Likes

HI there @pawanmtm,

If I got you right you were able to populate 2 sheets for each row and if summary sheet is populated automatically what is troubling you?

As a side node I find your workflow example a bit complicated to figure out. Perhaps next time try with fewer node and simple logic or a step by step approach with multiple topics (it is more topics for same issue but sometimes it is easier). Also you can add your data into workflow folder and use relative paths so reader nodes don’t have to be configured :wink:

See here: Reproducible (Minimal) Workflow Example

Br,
Ivan

3 Likes

Hi @andrejz,

Thanks for your time

You are correct to some extent.

I have the data to process in KNIME. Once it is processed, based on the variable created from create file name node, if the document type is Travel & Expenses, then write the data to T&E Sheet, otherwise write it to P2P Queries sheet. From these 2 sheets, i try to get the volume, value and average using excel formulas and then create graphs out of these numbers.

Then make a copy of the template file and rename (save as in excel term) with the variable.

Similarly all the files has to be created as per the number of users.

I am using the template, so that the summary sheet is updated automatic.

Hi @ipazin,

I don’t see the files created in the output folder, i am not sure where i am missing on this.

I have arranged the workflow step by step with annotation to have better understanding and will follow the same going forward, thanks for sharing the best practice. Since i did not reset the workflow while exporting and i thought other can see the workflow the way i see.

image

i am thankful to folks who are trying to understand and provide solutions as much as they can, i do try to put across the best way to make it more easy for others to grasp/know. I am sure we are very close and crack it soon.

Regards,
Pavan

Hi All,

Does anyone has any input on the above query.

Regards,
Pavan

Hi @pawanmtm,

So Excel Sheet Appender nodes are successfully but you don’t see files? Then you are writing them to a different location as to one you are looking…

Br,
Ivan

1 Like

Hi Ivan,

There is no change in the location, but still the files are missing, here is the screen shot of the same.

Regards,
Pavan

Hi @pawanmtm,

can it be that flow variables determining location are not well defined or configured? Don’t think I can help you more unless you share workflow that reproduces this with some (dummy) data…

Br,
Ivan

1 Like