"Data to report" node generate report with dynamic names

Hi all,
my workflow generates a pdf report using Data to Report node. when generating a report as pdf the report name by default “default_report”.
How to make the Data to report node generate automatically a report with the same name as my input file?
Thanks

Cheers.

Currently I believe the filename exported from a BIRT report is hardcoded, but I’m asking for confirmation on that - I’ll let you know.

UPDATE: It is indeed hardcoded.

Thanks ScottF Please let me know when you receive any new

There is a possible workaround, which is to have the report generation workflow running as a separate workflow which is called using either the Call Local Workflow or, if it is on a KNIME server, Call Remote Workflow node in an ‘outer’ workflow. The report is then returned as a blob column, which can be saved with whatever filename you like using the Binary Objects to Files node

Steve

could you send me a simple workflow? describe these features Thanks.

OK, attached are two workflows. Save them in the same folder in your KNIME workspace.

Report_Workflow.knwf (12.3 KB) generates the report (in this case, a very very simple report!), and is called by executing the second workflow:

Report_Name.knwf (9.6 KB), which runs it, and saves the report to whatever location you put in the Table Creator node in it.

If you are running on a KNIME Server, then replace the Call Local Workflow with a Call Remote Workflow node

Steve

2 Likes

Thank you for your reply.
I have another question. my input in the first workflow is XLS NODE reader mean I want the same names from the file input. Don’t need to add the name again in the second workflow in table creator Node.

My second question How can I make the variable attachementURL of the email node related to URL Path?
Note: the **attachementURL ** has a property arraySize Type Integer. mean it needs to find a solution.
How can I convert the path URL to a binary integer? Behind that I want the email node to get the attachment file of my report automatically.
any help will be gratefully received.

Thanks a lot.

OK, so revised attached workflows deal with the xlsx issue. To summarise:

Report_Workflow.knwf (19.4 KB) - modified to use xls reader, and a quickform to create a parameter for the path to the input

Report_Name.knwf (20.0 KB) - Modified to create report pdf filename from the name of the xlsx file, which is now in the input table. Note that you need to escape \ in the path to the xlsx file. The JSON format to pass the parameter is a bit un-intuitive (see e.g. https://www.knime.com/forum/knime-general/awkward-column-typing-in-call-remote-workflow-node). If you want to run for multiple xlsx, with 1 report per file, then replace the Table Row to Variable node with a Table Row To Variable Loop Start node, and finish the loop with a Variable Loop End node. Then a separate email will be send for each xlsx file

The second issue, regarding the email node is dealt with as follows:
1 - enter something in the attachments tab for the first attachment (it doesnt really matter what, it will be ignored). You should now see another, empty row appear:

image

2 - In the flow variables tab, scroll down to attachedURLs and expand. In the box next to ‘0’, select the flow variable with the report filename:

3 - If you new check back in the attachments tab - you should see a warning that the parameter ‘0’ is controlled by a variable:

The excel input file used was testin.xlsx (11.7 KB)

Hope this helps,

Steve

1 Like

Thank you that’s Great!
How can I attached MULTIPLE files and send each file to specific Personnes? Need to add another email node ?
file testin.pdf to persone1@gil.com
file testin2.pdf to persone2@gil.com
Bestes.

If you add an extra column with email recipients to the Table Creator node, and then change the Table Row to Variable node to a Table Row to Variable Loop Start node. Then configure the ‘To’ field of the Send Email node to use a flow variable (look on the Flow Variables settings tab), and use the email recipient variable- you will need to run the loop start node to see the available variables.

Finally, close the loop with a Variable Loop End node, using the hidden flow variable port on the output side of the send email node (see e.g. https://www.knime.com/wiki/flow-variables)

That should do what you want (you might want to test it with your own email address in each row first before you start spamming your colleagues/friends while you get it working!)

Steve

but my xls files name can change. I want to filter files by name
For example: in my Variable loop End node it gives me 3 reports I want to send report1 to list of people
if i have report3 sent to this list etc…

Assuming you always have the same filename/email recipient mapping, then use a Snippet Row Filter node, with the snippet body:

return new File(%xls-name%).exists();

(configure it by double-clicking on the column name containing the xlsx file names to get the correct text where the above example has %xls-name%). Put this node immediately after the Table Creator node. For multiple recipients, you could try , or ; separating them in the table column

Steve

1 Like

@Vernalis Thank you again for your explication.
I have a question about your last workflow Example when I run the workflow (report_Name) I got this error WARN Excel Reader (XLS) 0:4 Errors overwriting node settings with flow variables: Unknown variable "xlsPath" and the PDF report was sent empty means with DATA Set just the structure (synchronisation problem).
This is the report how it looks when I use dynamic text or grid
Untitled
I need every time to execute the workflow (report_Name) first then come back to the Report_Name to get a full PDF. Also i want to Save the File PDF in CreateTemp Dir Path node

Could you help me with this problem?
Thanks

Dear @Vernalis did you try the workflow with Dynamic Text?

No, have not tried with dynamic text (I assume you mean in the report), but no reason why it should not work. the flow variable error should resolve once the loop start or table row to variable node has executed
Steve

I already fixed this error _Excel Reader (XLS) 0:4 Errors overwriting node settings with flow variables: Unknown variable "xlsPath"_ my problem is in the Data to report node (every time I need to synchronize the Data set manually to get a full pdf report )
Please find attached my workflow.
Rename report Knime_workflow.knar (31.2 KB)
compte_test.xlsx (9.6 KB)
Post Market.xlsx (25.4 KB)

If the problem is that the columns in the report node change from one xlsx to another, then I dont think there is a solution to that, as the BIRT Reporting tool expects a data input to always have the same columns.

If anyone knows different, I would love to hear!

Steve

1 Like

Based in your suggestions I find the solution !! by adding a reference Table (has all the columns that I need) then filter them with Reference Column Filter Node
This is a screenshot of the solution. Untitled

1 Like

Nice solution. A couple of extra thoughts:

  • If your XLS might also be missing some columns, then you could add a Concatenate node after the Reference Column Filter node, with the 2nd input being the output from the reference columns node to ensure the missing columns are also there
  • For portability, you may want to put your Reference columns XLS in the workflow folder in a \data subfolder, and use a knime:/ protocol URL to access it. That way, if you move your workflow you will keep the reference XLS with it
  • Have a look at the Table Validator and Table Validator (Reference) nodes - they might also help with this task

Steve
`

1 Like

Could you help me with Topics: rename columns using column rename regex Node/ Normal column rename