#### Sending Statistics to an XML File Using XMLSTATS/ON

You can also send your statistical data to an XML file by using the XMLSTATS/ON command. This gives you access to the statistical data in a simple text format that you can then manually parse for use with third party tools. This command replaces the previous XML automation export utility named DataPageStats.exe that ships with Datapage+. You can then use the PcdmisXMLStatsToDatabase.exe utility in Datapage+ to monitor a directory and pull the data from the .xml files into the database. See Datapage+ documentation for information on how to do this.

To insert the XMLSTATS/ON command, type "XMLSTATS" and then press TAB in the Edit window's Command mode; or select the Insert | Statistics Command | XML Statistics menu item. This command has the following syntax:

XMLStats/<TOG1>,<Directory>

<TOG1> - This field toggles between either ON or OFF, letting you choose whether or not to export statistical data for measurement commands that follow this command.

<Directory> - This field takes a string (without quotes) as the directory pathway in which the file will be created. The default pathway is the directory where you store your part programs.

XMLSTATS/ON only writes the XML during execution. It writes the file to the specified directory and automatically generates the .xml file's name using this format:

<Part Program>_<Day>-<Month>-<dd>-<YYYY>_<hh>_<mm>_<ss>.XML

<Part Program> - The part program name without the PRG extension.

<Day> - The name of day the part program was executed in local time.

<Month> - The name of the month the part program was executed in local time.

<dd> - The day of the month in two digit number format in local time.

<YYYY> - The year the part program was executed displayed in four digit format in local time.

<hh> - The hour the part program was executed (in 24-hour local time).

<mm> - The minute the part program was executed in local time.

<ss> - The second the part program was executed in local time.

Thus, a part program named "Test.prg" executed on August 12, 2010 at exactly 2:40:15 PM local time, would have this file name: Test_Thursday_August-12-2010_14_40_15.XML

The XML file contains data for all commands that follow the XMLSTATS/ON until execution finishes or until execution encounters an XMLSTATS/OFF command. If execution encounters another XMLSTATS/ON command while writing to a file, it will write a closing </ExecutionTransaction> tag in the XML file and then allow the next XMLSTATS/ON command to write another opening <ExecutionTransaction> tag.

For example, suppose you had this pseudo part program:

XMLStats/ON

Dimension1

XMLStats/OFF

Dimension2

XMLStats/ON

Dimension3

Following execution, PC-DMIS would generate a single file with two <ExecutionTransaction> tags. The first tag would contain Dimension1:

<ExecutionTransaction DateTime=”Sometimestamp”>

<XMLStats command data>

<Dimension1 Data>

</ExecutionTransaction>

The second file generated would contain Dimension3:

<ExecutionTransaction DateTime=”Sometimestamp”>

<XMLStats command data>

<Dimension3 Data>

</Execution Transaction>

How it Differs from the Generic XML Export functionality:

XMLSTATS/ON only writes XML during execution, and it only writes commands following it. While it does generate the <PartProgram> tag pair, similar to the generic XML export, it wraps the XML commands inside an <ExecutionTransaction> tag pair.

How it Differs from DataPageStats.Exe:

- XMLSTATS/ON is faster than DataPageStats.exe.

- It outputs everything DataPageStats.exe did but includes more.

- You do not need to insert an external command at the end of your program as you did when using DataPageStats.exe.

- You can choose what data gets sent to the XML file by turning XMLSTATS commands on and off as needed.

- XMLSTATS adds a time stamp within each <ExecutionTransaction> tag pair. In addition, the filename itself, as discussed above, is comprised of the part name and the time of execution.