User Guide

292 Chapter 14: Data Integration (Flash Professional Only)
Default settings These settings let you set defaults for various situations. The following list
describes the uses for these settings:
If a field’s value is undefined, the default value is used whenever the value of the field is used as
the source of a data binding. For example, the data fields of a DataSet component, or the
results property of a connector component, can have an undefined value.
When you create a new row of data in a DataSet component, the default value is used as the
value of newly created records
Using kinds and encoders
Kinds and encoders are drop-in modules that perform additional special processing of the data of
a schema item. They are often used with each other to accomplish common tasks. The following
list describes common uses for kinds and encoders:
Calculated DataSet Fields Calculated fields are virtual fields that do not exist in the
underlying data tables. Calculated fields provide developers with the ability to create and update
dynamic field values at runtime. This is convenient for calculating and displaying values based on
calculations or concatenations performed other fields located in a record (for instance, you can
create a calculated field that combines the first and last name fields together to display the full
name to a user).
To set up a calculated field for the DataSet component:
1.
Select the DataSet component, and click the Schema tab in the Component inspector.
2.
Click the Add a Component Property (+) button. This step adds a field to the schema.
3.
Using the Schema Attributes pane, give the new component property a field name, and set its
kind to
calculated.
4.
In ActionScript code, use the calcFields event of the DataSet component to assign this field
a value at runtime.
Note: You should assign a value to a calculated field only within the DataSet component’s
calcFields event.
For an ActionScript code example, see “Schema kinds” on page 294.
Setting up schemas for XML documents In an XML document, all data is stored as a string.
Sometimes you want the fields of an XML document to be available as data types other than
String. The following example shows an application that pulls in data from an XML file:
<datapacket>
<row id="1" billable="ON" rate="50" hours="3" />
<row id="2" billable="OFF" rate="50" hours="6" />
</datapacket>
If you use this XML file to import a schema for the XMLConnector components results
property, it generates the following code:
results : XML
datapacket : Object
row : Array
[n] : object