Start Here
Data Modelling
UI
API
Development
Overview
Variables
Built-in Types
record
or-type
list
Variables
ftd has support for rich data modelling, and it supports declaring variables.
-- integer x: 20
Variables have types.
Auto Guessing Basic Types
For built-in types, integer, boolean, etc, ftd can guess the type based on the value:
-- integer x: 20
Types
Type of a variable can be one of the built-in types, a record, or an or-type.
Referring To Another Variable
A variable can be defined as referring to another variable.
-- integer x: 10

-- integer y: $x
Updating a Variable
Once a variable has been defined it can be updated too:
-- integer x: 10

-- $x: 20
The type of the variable can not be updated.
$processor$: dynamic variables

ftd documents are processed in the context of a “platform”, and platform can provide access to dynamic variables.

Say platform has provided a dynamic variable os, which is the operating system on which this document is getting rendered, you can use that like this:

-- string name-of-os:
$processor$: os

type is mandatory when using $processor$. Available processors would be documented as part of platform documentation.

Processors can also look at data passed, so its possible to create a processor:

-- string greeting: hello, world
$processor$: uppercase
Say the platform has provided a processor uppercase, which takes the current value, hello, world and returns its upper case value. In this case the variable greeting will hold the value: HELLO, WORLD.