Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 48 Next »

Overview

When you are setting the properties of a file exporter, setting the Type property to Excel Spreadsheet (Multi Input) adds an extra field, Excel Template (Expr) to the property tab; see File Exporter.

Use this option to add an expression that resolves to the name of a template file, which must exist. PhixFlow uses a template file to guide which values from which input pipes are written to which cells or cell ranges in the template file.

The Excel Template (Expr) is re-evaluated inside the input multiplier loop. This means it is possible for successive evaluations of the expression to give different values. Each value represents the name of a template file, which must exist.

Each pass of the input multiplier loop generates a new output file.

Using an Excel Template

Specify an Excel Sheet

You can specify an Excel sheet name as a template instruction.  PhixFlow reads an attribute from a pipe to construct the sheet name:

{pipe_name:attribute}

Where:

  • pipe-name specifies the pipe
  • attribute specifies the attribute.

For example, to use a value from the stream attribute called code, which is pulled from the pipe called "in", specify:

{in.Code}

Use Cells as Template Instructions

Any cell in the template may be set to a template instruction.

A template instruction looks like this:

{keyword: value, keyword: value, ...}

Valid keywords are:

KeywordValueMeaning
sourcepipe

The source keyword is the top left cell of a region in an Excel spreadsheet. The region comprises multiple rows that will be overwritten by the rows read from the pipe.

If there is a corresponding column:last to the right on the same row, that marks the right-most column of the region. If not, the region extends to the last cell on the row or the last cell before the start of another region.

If there is a corresponding row:last below on the same column, that marks the last row of the region. If not, the region extends to the last row on the worksheet.

valuepipe.attribute

The value of this cell should be set to the value of the indicated pipe attribute.  

Specify pipe.attribute for a standalone value. This represents a one-column, one-row region.

If the value is inside a defined region, the pipe is already defined at the start of the region. In this case, specify attribute only.

Always specify the pipe name, even in a multi cell region.
rowlast

This is the last row of a region.

Each row:last must be matched to a source above it in the same column.

columnlast

This is the last column of a region.

Each column:last must be matched to a source to the left of it in the same row.

excludepipe.attribute | true | false

Use this keyword to delete a worksheet, using the exported data.

true: delete the worksheet from the output Excel file if the attribute is exported to the worksheet.

false: keep the worksheet in the output Excel file if the attribute is exported to the worksheet. This is the default when no keyword is set.

Where a cell is not formatted as text, prefix-quote the contents to store a text annotation.

Definitions

TermDefinition
multi-row source

A pipe that will be used to return zero or more records.

Any value reference to an attribute of a multi-row source returns

  • the value of that attribute on the current row
  • or null if there are no more records.

The current row is advanced once for each row in the multi-cell region from which it is referenced.

single-row source

A pipe that will return zero or one records.

Any value reference to an attribute of a single-row source returns

  • the value of that attribute on the first row read
  • or null (i.e. it leave the cell blank) if no rows were read.
multi-row region

A rectangular group of cells whose contents will be overwritten by multiple records read from a pipe. A region can be

  • a single row/column
  • a specific number of rows/columns
  • extend to the end of the row/column.

A row in the Excel spreadsheet can contain only one multi-cell region. A multi-row region cannot overlap any other multi-cell region. PhixFlow will report an error if either of these arrangements arise.

The region is defined by:

  • a source keyword in its top-left cell
  • a row keyword, to specify the bottom boundary
  • a column keyword it specify the  right boundary.

The source keyword indicates the pipe

  • has multiple rows of data, so is a multi-row source
  • is the origin or source of records to populate the region in the Excel spreadsheet.

When PhixFlow writes data into Excel using the template:

  • One row of the region will be populated for each record read from the source pipe.
  • The value to be written into each populated cell is determined by the value directive in the corresponding cell in the first row of the region.
  • The value keyword can refer to any attribute of the multi-row source that is linked to the region.
  • Where the region contains more rows than the source, the remaining rows will be set to blank or zero, depending on whether they are string or number cells.
  • Where the source contains more rows than the region, additional rows will be inserted below the region using the type, format and other properties of the last row of the region.
single-cell region

A single-cell region is defined by a cell that is outside any multi-row region and contains a value keyword that can refer to any single-row source. When data is written using the template:

  • PhixFlow writes the value of the nominated attribute in the first row returned by the single-row source.
  • If there is no value to be found in the attribute, PhixFlow writes a blank cell.

Sections on this page


  • No labels