D E G H L O P S W

Substitution Fields

Substitution fields

This is how the data is put into the outputs and the paths used.
A normal field is surrounded by matching double brackets

Basic values

Acceptable paired field markers. Use the type that is safe for the templates you are using.

{{FieldName}}
[[FieldName]]
((FieldName))
<<FieldName>>
##FieldName##
@@FieldName@@
%%FieldName%%

{{TestValue}}-[[TestValue2]]         This will give the output of
ValueContent1-valueContent2, NOT A CALCULATION

There can be no spaces between the double brackes and the field names

Formatting

A more complicated field can contain a formatted field, calculation or a flow control statement

These can be like
[[AValue:format detailsofformat]]
or
[[AValue format detailsofformat]]

[[AValue case propercase]]

[[eval calculation]]

[[IF AValue]] stuff [[endif]]

[[beginif aCalculation that equates to true]] stuff [[endif]]

In a calculation a field can be represented as it’s name, or as a nested substitution

On a value, you can use a modifier to the value returned.
an example is
{{mydate:format s}}
which will give the date of mydate in format yyyy-MM-ddTHH:mm:ss
or [[MyMoneys format #,##0.00]]
which gives the value of MyMoneys in format of 1,234.56
or [[MyName case ProperCase]]
which will, in this case, make each word start with a capital letter

The formatting modifiers are :

Format – uses formats on dates and numbers based on MS.net formatting

For dates see https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings
Can use custom formats as well. See https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
For numbers see https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
can use custom numeric formats as well.See https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings

Case – uses case formats based on vbStrConv

Most common case types would be : Uppercase, Lowercase, Propercase
For reference See https://msdn.microsoft.com/en-us/library/microsoft.visualbasic.vbstrconv(v=vs.110).aspx

Conditional blocks

You can use opening brackets for a conditional display block followed by using one of

if, beginif, ifbegin, begin

then a value to be not empty or calculation to a positive result to test

By a non-empty expression, this means
for boolean, true
for numbers, non zero (0)
for string, not empty

then the closing brackets

then the data to show if the condition produces a positive result, including line feeds

then close the block with

endif, ifend, end in the opening and closing substitution brackets

Some examples of a complicated expression

{{if "[[value]]" <> "No" AND "@@value@@" <> ""}} Stuff {{endif}}

More examples. Note that line feeds are not ok inside the substitution brackets, but ok outside them or between parts of a conditional expression

((If "[[TestValue]]" <> "Wot"))stuff{{endif}}

((If [[TestValue]]))stuff{{endif}}             Will be false if the field doesn’t exists or is blank

((If TestValue))stuff{{endif}}              Will be false if the field doesn’t exists or is blank

((If NOT TestValue))stuff{{endif}}              Will be TRUE if the field is blank or equates to false

((If "[[TestValue]]"))stuff{{endif}}              Will be false if the field doesn’t exists or is blank

((If "TestValue"))stuff{{endif}}              Only if the field exists

((If [[TestValue]]="Value"))stuff{{endif}}              Will be false if the field doesn’t exists or is not equal to value

((If TestValue="Value"))stuff{{endif}}              Will be false if the field doesn’t exists or is not equal to value

((If "[[TestValue]]"="Value"))stuff{{endif}}              Will be false if the field doesn’t exists or is not equal to value

((If "TestValue"="Value"))stuff{{endif}}              WILL BE FALSE

{{beginif [[fred]]}}Fred{{if [[jones]]}} Jones{{endif}}<> Bloggs((endif))((endif))

{{beginif [[fred]]}}Fred{{if "[[jones]]" <> "No" AND "@@Jones@@" <> ""}} Jones{{endif}}<> Bloggs((endif))((endif))

{{beginif [[fred]]}}Fred{{if "[[jones]]" <> "No" AND "@@Jones@@" <> ""}}
Jones{{endif}}<>
Bloggs((endif))((endif))

{{beginif [[fred]]}}Fred{{if "[[jones]]" <> "No" AND "@@Jones@@" <> ""}} Jones{{endif}}<<if {{Bloggs}}>> Bloggs [[eval 2*len("{{Bloggs}}")]]((endif))((endif))

[[if datediff("d", now(),"##mydate##") < 10]]Fresh[[endif]]

Calculations

You can use any Visual Basic single result expression (Scalar expression) for a calculated result

Use a marker of

eval, evaluate, compute, calculate, calc

examples

[[eval left("((Test))",((Size)))]]

{{eval datediff("d", now(), dateadd("d",5,"##mydate##"))}}

{{eval datediff("d", dateadd("d", 5,now()), "##mydate format s##")}}Note the formatted value for mydate in the calculation. This is done before the outer calculation.

{{eval datediff("d", now(), "##date##"}}

Related Entries