When you create a Guide using the New Guide wizard, start
by selecting an entity as the root entity. The wizard uses the root
entity as the main application entity for the Guide and configures
it to be loaded from XML data.
An alternative method for creating additional entity instances
is to use the Create Data Object option in the Data Model view.
These entities can also be populated with their own XML data files.
Adding entity instances provides a convenient way of providing dynamic
code tables to the Guide without requiring a database.
Create additional entity instancesIn the Data Model view, right-click and select
Add Data Object.
On the Add Data Model page, select the appropriate entity
and click OK.
In the Guide Properties view for the new data object, do
the following actions:
In the Name field, specify
the name of the instance of the entity.
Select the XML file to load into this entity at run time.
Note: If you do not select an XML file, an instance of the entity is created without data.
You
can use this entity to bind to fields by dragging the data properties
from the entity onto the canvas. You can also use collections in
this entity as data for lists.
Use an additional entity instance as a code tableTo provide a list of property types and codes to use in
the Guide, you can use additional entities populated from a separate
XML file. By using additional entities, you can populate a list
without including the list data with the main data model.
Example Property Type Code tableYour main model has a data model
property called propertyCode. Select that property code for
a list of values from an XML file.
Select the property code for a list of values from an XML fileIn your data model, add two entities: one for the property
type (PropertyType) and one to hold the property
types’ collections (PropertyTypes), similar to
the following example:
<entity name="PropertyType">
<property name="propertyCode" type="string"/>
<property name="propertyName" type="string"/>
</entity>
<entity name="PropertyTypes">
<property name="propertyType" type="PropertyType[]"/>
</entity>
Create an XML file to populate the property type code table:
<PropertyCodeTable>
<PropertyTypes>
<propertyType>
<propertyCode>1</propertyCode>
<propertyName>Condominimum</propertyName>
</propertyType>
<propertyType>
<propertyCode>2</propertyCode>
<propertyName>Duplex</propertyName>
</propertyType>
<propertyType>
<propertyCode>3</propertyCode>
<propertyName>One Story</propertyName>
</propertyType>
<propertyType>
<propertyCode>4</propertyCode>
<propertyName>Two Story</propertyName>
</propertyType>
</PropertyTypes>
</PropertyCodeTable>Copy your data file to the LiveCycle application directory.
Create a Guide from the data model containing the two entitiesIn the Data Model view, right-click and select Add Data Object.
Select the PropertyTypes entity and click OK.
Select the XML file to load into this entity at run time.
The XML file can be in any local application in Workbench.
In the Data Model view, right-click and select Add Data Object.
Select the PropertyType entity to act as the selected
property type and click OK.
Drag the PropertyType entity instance onto the editor.
The property type is a drop-down list by default.
In the Guide Properties view, bind the List Data property
to the PropertyTypes.PropertyType collection in the Data
Model view.
Bind the Caption Text to propertyName in the Data
Model view.
In the Data Model view, right-click and select Add Binding.
Configure the binding to copy the PropertyType.propertyCode to
the main model propertyCode. The selected property code,
which is associated with the selected propertyType, moves
to the propertyCode in the model whenever it changes.
Drag the propertyCode from the main model onto the
Guide.
Click Preview. The PropertyTypes drop-down list displays
the property name for the four property types.
In the PropertyTypes drop-down list, select a property
type. The selected property type populates the property code.
When
you click the Complete button in Workspace, or the Submit button
in a web browser, only the property code is submitted. The additional
entities are used only for look-up information and are not part
of the main model.
|
|
|