Var (Excel)

From Tygron Support wiki
Revision as of 15:49, 3 March 2021 by Rudolf@tygron.nl (talk | contribs) (Created page with "File:ExcelVars2.jpg|framed|right|In this example, the output of the Excel will read "this 1.234,568 is 56 % text". There are not enough places to insert all VARs, so <code>V...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
In this example, the output of the Excel will read "this 1.234,568 is 56 % text". There are not enough places to insert all VARs, so VAR_2 is ignored. However, it is calculated.

In some situations, you may find that the contents output of the Excel file remains mostly constant, save for a number of numerical values. In this case, you can choose to use VAR cells, which serve as additional output cells. The values placed in these cells are read by the Tygron Platform, and inserted into the explanation output. The Tygron Platform will also format the numbers for readability. Specifically, thousands separators will be added (if needed), a decimal separator will be added (if needed), and the number will be rounded to 3 decimal digits.

To define one or multiple VAR cells, name a cell VAR_N, where N is a sequential number starting at 0 (so VAR_0, VAR_1, VAR_2, etc). To indicate where in the explanation the VARs should be inserted, you can create an insertion point by writing "%s" in the explanation. The Tygron Platform will insert each VAR, in order, into these places in the text.

Note that while it's possible to use formulas or conditional structures in your Excel to come to an explanation with zero, one, or multiple insertion points parts, it is important to remember that the Tygron Platform will only look at the text which ends up in the EXPLANATION cell to insert VARs. If you remove a segment of the explanation which contained an insertion point, the VARs which used to be inserted there will be inserted in the next ones instead. If this is undesirable, either keep the insertion points for the VARs in the text, or restructure the VAR cells in the excel so that the correct values are inserted in the correct locations.

Also note that the Tygron Platform will ignore additional VAR cells if there are not enough insertion points (although the cells will still be evaluated), but that the Tygron Platform will be unable to display the explanation properly if there are too many insertion points. If that is the case, an error will be displayed instead of the proper explanation.

Lastly, when using VARs, the Tygron Platform will check the output text for any "%" symbols. If you wish to use a literal "%" in your explanation while using VARs, you can instruct the Tygron Platform to leave it as is by writing "%%" instead.