For reports it is possible to define formulas that will take analysis object values (or other fields) as arguments. They are especially handy in templates.

Formulas can be used to:

·Calculate special values based on thermal measurements;

·Automatically assign fault ratings and display them as text;

·Change text and color of a field by on a condition.

First you create formulas, after that you can use them as fields and in tables (including summary tables).

Creating list of formulas

Open a report template (or a document) in Word. To define formulas find 'Field' button in Thermo Reports toolbar, click on a small arrow under the button and select 'Formulas' item.

formulas button

A dialog with list of formulas will appear:

formulas list dialog

Click on 'Add' to add a new formula:

formula editor

First you should give your formula a name.

Then you need to enter your formula in the 'Expression' box. You can use other fields as arguments of your formula. To insert an argument press 'Reference' button and select a field you need in your formula.

Note: In formula expressions you cannot use other formulas.

Numeric formulas

Normally a formula is a numeric expression. In this case all arguments must be numbers. As arguments you can use such values as image temperature maximum or a spot value, and not text fields such as image name, comment or notation. For numerical expressions you can use functions you find in 'Functions' list. Double click on a function to insert it to the expression.

Please pay attention that mathematical functions must have "math." prefix. For example abs() must be used as math.abs().

Unit

For a numeric expressions you can use 'Keep unit' to automatically add unit to the formula result. Unit is automatically deduced from the expression arguments. Usually this is the temperature unit. If unit of the formula result is different from the unit of arguments, you can add the correct unit explicitly using concatenation operator "..". For example:

A+273.15 .." K" 

Precision

'Precision' defines how many digits after the decimal point resulting number must have. Precision does not work if you a add custom unit with ".." operator as described above.

Text formulas

Formula result can be some text. The simplest case - you just use a text field and add some symbols to it. Use concatenation operator:

"<<"..FAULT_RATING..">>"

For a more realistic example you would need to use if-then-else-elseif-end keywords:

if math.abs(A-B)>20 then return "Critical Fault"

elseif math.abs(A-B)>10 then return "Possibly Fault"

else return "No fault"

end

Note: Formula expression can be any LUA script.

Inserting formula as a field

After list of formulas is ready you can use them in fields and in tables, just like any other field. For example, use 'Field' button in Thermo Reports toolbar to create a field which takes its text from a formula (you will find formulas in the field tree).

Conditional field coloring

Using formulas you can instruct report system to change color of a field when some condition is fulfilled. You can also make font of a field to become bold. This works for fields and also for fields in tables.

But it is a bit not straightforward. You cannot select any field and define a condition when it must be changed. It is only working for formula fields. So if you need a field to be conditionally colored you first convert this field into a formula and then define the coloring condition.

Let's assume we have Fault Rating notation and we want it to be displayed in our report bold and in red color when temperature difference between spots A and B is bigger than 20 degrees.

First we create a new formula that just copies value of Fault Rating field:

fault rating colored

Now we can define a condition for coloring the text. Click on 'Field Style' button and enter the condition text (using 'Edit' button):

field style dialog

Now you can use formula 'Fault Rating Colored' as a field or in a table and text will automatically change its color when the specified condition is true.