Skip to main content
Windward

How to use multiple data sources and variable maps with RunReport command line

Overview

How to use multiple data sources and variable maps with RunReport command line.

Resolution

Question

I am running Windward from command line, using: java RunReport rtfname.rtf reportresultname.htm -xml xml.xml. I also have a separate file (named mapping.xml) where I keep all mapping data for RTF template. How can I invoke this mapping.xml file from command line running RunReport? Please advice. Thanks.

ANSWER

Yes this is possible.

You will have to assign a nickname to each data source in your template using the NICKNAME field in the data source connections window.

By default when you only have one data source in a template there is no nickname assigned. When you have two or more data sources in a template you need to assign a nickname to each.

Once you have nicknames assigned to your data source you will then have to assign each tag to use the data source nickname that the tag should pull data from.

IE

2 data sources:

Data.xml - nickname="data"

Filenames.xml - nickname"filenames"

Template.docx contains 2 tags:

OUT tag referencing data source "data"
<wr:out select="/Root/Data" datasource="data"/>

OUT tag referencing data source "filenames"
<wr:out select="/Root/file" datasource="filenames"/>

When calling the template from the command line you can reference each data source by specifying the -xml switch and placing the data source nickname after the : and then referenceing the data source filename.

IE

java net.windward.xmlreport.RunReport template.docx output.docx -xml:data Data.xml -xml:filenames Filenames.xml

You can also specify command line parameters for variables as well is space delimited lists following the RunReport command like so:

java net.windward.xmlreport.RunReport template.docx output.docx -xml:data Data.xml -xml:filenames Filenames.xml "var1=value1" "var2=value2" etc......

Please let me know if you have additional questions.

  • Was this article helpful?