Skip to main content
Windward

Windward Equation Overview

 

AutoTag has built-in equations and functions for the tags in your templates. These are different from the functions, equations, and macros that are native to MS Office.

 

Windward supports equations and functions for Out Tags in Microsoft Office Word, Excel, and PowerPoint templates. This allows you more options in manipulating your data directly in Windward products. 

 

For example, you can:

  • Work with more complex mathematical functions, like taking the the square root of a number

  • Add or subtract from a date to adjust for time zones

  • Easily add a time stamp that is set when the report is generated

  • Have your equation evaluated as you type

  • Import custom functions that will appear in the AutoTag interface

 

About Equations

An equation is like a function returning a result. There could be logical and arithmetic equations.

Any equation starts with the equal (=) sign in the tag's select property.

 

Some examples of simple equations are.

Arithmetic Equations

An arithmetic equation producing the result of 5 when evaluated.

=2 + 3

Logical Equations

A logical equation producing the result of True (a boolean value) since the comparison is made in the case-sensitive manner.

='A' != 'a'

Common Operators

While writing an equation you can use common operators, like

 

Mathematical Operators

Comparison Operators

Addition

+

Equals

Subtraction

-

Not Equals

!=

Multiplication

*

Less than

<

Division

/

Greater than

>

 

 

Less than

or

Equal to

<=

 

 

Greater than

or

Equal to

>=

 

 

For the operands you use constant values, like in the above examples.

For a full list of equation functions, see our article: List of Equation Operands.

Variable References

You can reference other tags by means of variables, surrounding their names by ${ and }, a variable with the name set to Total (by using the var property in a tag) would be referenced in other tags by ${Total}

 

For example the variable ${Total} will be substituted with the result of a tag that is assigned a variable named Total.

Built-in Functions

There are set of built-in functions which you can use in your equations by using the Equation Editor.

 

A note about Equations

Microsoft Word and PowerPoint

Keep in mind that Microsoft Word and PowerPoint do not have the ability to use equations and functions with the program natively (only Excel has its own set of equations and functions). Microsoft Word and PowerPoint do have an equation button located in the Symbols section of the Insert tab. However, this just gives the ability to write equations that appear in multi-line formats so they display cleanly in the document. These equations do not evaluate or produce a result.

 

This is why Windward built a library of equations to be used within Windward tags. Most commonly an equation will appear in an Out Tag and print the evaluated result when the template generates a report. Plus Windward also gives you the ability to program your own custom functions to be used in Windward tags

Microsoft Excel

Microsoft Excel works differently. While you can use Windward's equations and functions within tags in Excel, you can also use Excel native functions and equations. This is special feature of Windward that will automatically calculates any native Excel equations when creating a report also works with these native Excel equations. However, we do not support every function that Excel provides for this feature.

 

This subset of supported functions when using Excel native functions together with references to Windward tags is listed below. Keep in mind that you can still use Windward's equations and functions to reference Windward tags and also within Windward tags to produce your desired result. Again, if there is a function or equation you need for your report calculations that is not provide by either Excel or Windward natively, then you can create your own custom function within Windward.

 

An example of this is when you use the native Excel function SUM() to point to a cell that contains a Windward Out Tag. Lets say you have an Out Tag in a ForEach loop in cell E10. That Out Tag returns a result of a subtotal each time the ForEach loop runs.  If the loop runs 20 times, then Windward (because it supports updating the Excel SUM function) will produce a report that updates the original native Excel function SUM(E10) to SUM(E10:E20).  This is because the cell referred to in the SUM function increased from a single cell to a range of 20 cells E10 to E20. The result is that since the SUM function was updated it will display the proper sum of all 20 subtotal generated from the Out Tags.

 

Current natively supported Excel functions and equations for use with Windward tags is listed below.

  • Any Excel function or formula with a reference(s) to a cell(s) within a ForEach area. Cells references outside a ForEach area will not have their formulas or functions updated with values and/or cell ranges by Windward.

Custom Functions

You can define your own functions by using Windward custom functions mechanism (see Custom Functions Guide).

 

Using a Dataset in an Equation 

If you want to include a dataset returned by a SQL or XPath select into an equation, you have to use the data() function. Pass the select statement as an argument to the data() function and use that in the equation, e.g.

=data('select some_value from some_table') = 5

The equation executes the select which returns some value and that value is used in comparison.  This is important to remember when working with functions that have a SQL or XPath equivalent, like SUM().

 

=SUM(data("<select or xpath expression>")) uses a Windward equation, because it begins with an '=' sign. It therefore requires use of the data("select") wrapper for your select. The statements

 

SUM(<xpath expression>) and SELECT SUM(<column>) from <table>  use the built-in XPath and SQL sum functions, respectively, and not a Windward equation. This means they are treated as selects, not equations.

Example

In the following example, we start with a blank Word Document and end up with a template that uses the new function Equations feature. 

 

1.  Open a new Word document.  Create an Out tag in AutoTag by selecting the Out button in the Tags menu.

Equations - 01 AddOutTag.png

 

2.  Open the Tag Editor for new Out tag by double-clicking it...

Equations - 02 OpenTagEditor.png

 

3.  This will bring up a new window. Click on the equation button to open the Equation Editor.

Equations - 03 OpenFunctionSelector.png
 

4.  Select the function you would like to use.  In this case, we will select the CONTAINS function and then click Ok.

Equations - 04 FunctionSelector.png
 

5.  You are now presented with the ability to fill in the arguments for the function.  Note how the arguments, the function, and the equation results are updated as you work.

Equations - 05 FunctionArguments.png
 

6.  You can also make modifications directly in the formula at the top.  This updates the results accordingly.

Equations - 06 FunctionEditing.png
 

7.  If you are connected to a data source, you can use that data for the arguments as well.

    In this case, I've connected to the Windward public SQL Server

        server: mssql.windward.net

        username: demo

        password: demo

        database: Northwind

    Click on the wand icon next to the argument to select your data.

Equations - 07 FunctionWithData.png
 

8.  Select the data you would like using the pop-up SQL Wizard or XPath Wizard.

Click Ok when you are done and you can see the new result of the formula.

Equations - 08 FunctionDataSet.png

  • Was this article helpful?