Data

<< Click to Display Table of Contents >>

Navigation:  IWML > Data Binding > Tags >

Data

Usage

 

=data(locator:value).<data source name>.<field name>:<format>

 

Data sources such as REST and JSON data can be bound to in IWML by specifying the URL source in the data property. The keyword data is used to bind to properties in the code behind object.

 

Because this source type is the most commonly used type and a name must also be specified, the tag for this source type can also be an implicit default using an empty string. The following two statements are identical:

 

=data.Users.Name

=.Users.Name

 

Field name can also specify multiple values in case of embedded objects in the data:

 

=.Users.Address.City

 

Locator

 

Locator is optional.

 

If not specified, the value will be bound to the default cursor of the data set and updated as the cursor is moved. ie:

 

=.Users.Name

 

To bind to a specific row a locator and value can be specified to bind to a specific row in the dataset. Movement of the cursor will not affect the data. Binding to a specific row is useful for creating grids, tables and other controls that enumerate a dataset.

 

Key

 

=.Users(Key:4).Name

 

Will bind to a row with a key of 4.

 

Index

 

=.Users(Index:4).Name

 

Will bind to a row with a key of 4.

 

Example

 

ACORN 1.0 IWML 1.0

Page

 Data[]

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

 ]

 Cells[]

   SimpleStack[]

     Text [b]Name

     Text =.Users.name

   ]

 ]

]