Creating dynamic code tables using auxiliary XML files

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.

Creating additional entity instances

  1. In the Data Model view, right-click and select Add Data Object.

  2. On the Add Data Model page, select the appropriate entity and click OK.

  3. 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.

Using an additional entity instance as a code table

To 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 table

Your 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 file

  1. In 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>
  2. 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 entities

  1. In the Data Model view, right-click and select Add Data Object.

  2. Select the PropertyTypes entity and click OK.

  3. Select the XML file to load into this entity at run time. The XML file can be in any local application in Workbench.

  4. In the Data Model view, right-click and select Add Data Object.

  5. Select the PropertyType entity to act as the selected property type and click OK.

  6. Drag the PropertyType entity instance onto the editor. The property type is a drop-down list by default.

  7. In the Guide Properties view, bind the List Data property to the PropertyTypes.PropertyType collection in the Data Model view.

  8. Bind the Caption Text to propertyName in the Data Model view.

  9. In the Data Model view, right-click and select Add Binding.

  10. 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.

  11. Drag the propertyCode from the main model onto the Guide.

  12. Click Preview. The PropertyTypes drop-down list displays the property name for the four property types.

  13. 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.

// Ethnio survey code removed