Data Binding

<< Click to Display Table of Contents >>

Navigation:  IWML >

Data Binding

IWML supports both one way and two way data binding to objects, including data obtained and updated by REST.

 

Syntax

 

To bind any IWML property use the syntax:

 

=type(parameters).field1(parameters).field2(parameters):modifier

 

Parameters are not supported by all types or fields. It is dependent to each specific type and field. Modifier is always optional. The only universally required part is type.

 

For example, this binds a property to a data value in a dataset on the default cursor:

 

=data.Users.Name

 

Type

 

Source type specifies a specific handler to handle the data binding. Each source type has its own requirements as to which parts are optional or not.

 

Fields

 

The number of fields supported depends on the type. Some types do not require or support any fields. For example:

 

=null

 

Parameters

 

Each type or field defines how it handles parameters. Some types and fields may require parameters, while others may treat them optionally, nor not support parameters at all.

 

Some types treat the entire parameters field as a single parameter such as HTTP:

 

=HTTP(https://jsonplaceholder.typicode.com/users)

 

Other types support multiple parameters of the form:

 

name1:value1 name2:value2, ....

 

Name value pairs are separated by a space and spaces cannot exist in names or values.

 

Example:

 

=Rows(join:|).Products.Name

 

If a parameter values contains a space, then it must be surrounded with additional parenthesis:

 

=Rows(join:(, )).Products.Name

 

Normally whitespace is ignored. Adding the additional parenthesis ensures that the value for the join parameter is a comma and space, not just a comma.

 

Modifier

 

Modifier is always optional and can also be used with any source type. If not specified, the : is not necessary. Modifiers can be used to transform or format the data values.

 

Modifiers are independent of other fields and work on the result provided by the source type.

 

In Markdown

 

Data binding can exist in markdown using the data markdown. Any bindings in markdown are one way and read only as markdown has no input. This is useful to mix binding inline with other text. For example:

 

Name: [=.Users.Name]

 

Assuming a value of Peter, this will produce and end result of:

 

Name: Peter

 

Use in markdown is not limited to data, and any binding expression is valid.

 

Properties

 

If the target of the binding is an IntraWeb property (Atozed.Props.Property<>) then .Value can be used, or omitted.

 

These two are identical:

 

=page.Slider.Max.Value

=page.Slider.Max

 

Special Values

 

These are not true data binding expressions, but are treated as such to avoid requiring an additional special notation.

 

==Text

 

The leading = is what signifies that the property is to be data bound. If the property is a text value and = is actually needs to be displayed rather than data bound, use == instead and only one = will be displayed. For example:

 

==This is raw text that starts with a single = and is not data bound.

 

Types

 

To bind to data, first a source of the data must be chosen, aka a data source. Currently IWML supports the following data sources.

 

Data source types are not case sensitive. this, THIS, and This are all the same. Field names however are usually case sensitive.

 

” (Empty String)

* (Enumerated Row)

HTTP

Data

Page

Prop

Rows

This

URL