Data Sources

frevvo v10.2 is no longer supported. Please visit frevvoLatest for our current Cloud Release. Earlier documentation is available too.

Data Sources

 allows you to generate forms automatically based on one or more pre-existing XML schemas. This enables you to quickly create forms that align with your databases, web services, BPM system, and key business applications.

For practical examples of this approach please refer to Creating a Form Connected to your Database.

In general, 

 can be created via two different methods:

  1. By dragging Palette Controls onto the form canvas

  2. By adding controls from a data source

It's very common and easy to create your form by dragging and dropping controls from 

' control palette to the form canvas. As you do this
automatically creates an XSD description of your form's controls. You can download this XSD from the Forms and Workflows Home Page. This method is typically used when your forms do not need to integrate with a back end system.

You can mix and match these two approaches of form creation. You can create all the controls in your form from XML schema elements. You can create all the controls in your form from the 

palette. Or you can create part of the form from schema elements and part from palette controls that have no relation to the elements in your schema.

Basic Concepts

When users submit a form that was created wholly or in part from schemas, you will see in the Submissions repository one XML instance document for each global schema element. You also will see one XML document for the form itself, which references any controls you dragged in from the palette.  All XML documents are automatically validated against their schemas.

When you upload a schema to

, you can use any and all global elements in the schema. If you want items from the schema that are not global elements, edit the schema and make the items global elements before uploading the schema to

At a high level, when you work with schemas you do the following:

  • Upload your schema to one of your

     projects

  • Choose the global elements you want and add them to your form’s Data Sources 

  • Generate form controls from the global elements you added 

  • Modify the controls (if necessary) to suit your form

These steps are discussed in detail below.

Form Schema

 automatically generates an XSD schema representation of your form as you drop controls from the 
palette to the form designer canvas. You can download this XSD by selecting
 Download Schema from the 
Action Menu on the Forms and Workflow Homepage. The XSD elements are named after the control names. The types are based on which control you selected from the palette. For example a Quantity control will appear as an xsd:integer. A dropdown will be an xsd:simpleType restriction. Controls with patterns such as the Zip will have an auto-generated type with your pattern. Click "expand Source" for an example.


<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.frevvo.com/schemas/_0LaA4HRREeGXK6NO-8HLWA" xmlns:frevvo="http://www.frevvo.com/appinfo" targetNamespace="http://www.frevvo.com/schemas/_0LaA4HRREeGXK6NO-8HLWA"> <xsd:element name="CompanyInfo" type="CompanyInfoType"> <xsd:annotation> <xsd:appinfo> <frevvo:displaytype/> </xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:complexType name="CompanyInfoType"> <xsd:sequence> <xsd:element name="CustomerInformation" type="CustomerInformationType"> <xsd:annotation> <xsd:appinfo> <frevvo:displaytype>Section</frevvo:displaytype> <frevvo:label>Customer Information</frevvo:label> </xsd:appinfo> </xsd:annotation> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:complexType name="CustomerInformationType"> <xsd:sequence> <xsd:element minOccurs="0" name="CompanyName" type="xsd:string"> <xsd:annotation> <xsd:appinfo> <frevvo:displaytype>Text</frevvo:displaytype> <frevvo:label>Company Name</frevvo:label> </xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element minOccurs="0" name="Revenue"> <xsd:annotation> <xsd:appinfo> <frevvo:displaytype>Money</frevvo:displaytype> <frevvo:label>Revenue</frevvo:label> </xsd:appinfo> </xsd:annotation> <xsd:simpleType> <xsd:restriction base="xsd:double"/> </xsd:simpleType> </xsd:element> <xsd:element minOccurs="0" name="Employees"> <xsd:annotation> <xsd:appinfo> <frevvo:displaytype>Quantity</frevvo:displaytype> <frevvo:label>Employees</frevvo:label> </xsd:appinfo> </xsd:annotation> <xsd:simpleType> <xsd:restriction base="xsd:decimal"> <xsd:pattern value="[\-+]?[0-9]+"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element minOccurs="0" name="IncorporationDate" type="xsd:date"> <xsd:annotation> <xsd:appinfo> <frevvo:displaytype>Date</frevvo:displaytype> <frevvo:label>Incorporation Date</frevvo:label> </xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element minOccurs="0" name="State" type="StateType"> <xsd:annotation> <xsd:appinfo> <frevvo:displaytype>Dropdown</frevvo:displaytype> <frevvo:label>State</frevvo:label> <frevvo:itemLabel>CT</frevvo:itemLabel> <frevvo:itemLabel>MA</frevvo:itemLabel> <frevvo:itemLabel>NY</frevvo:itemLabel> </xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element minOccurs="0" name="Zip"> <xsd:annotation> <xsd:appinfo> <frevvo:displaytype>Text</frevvo:displaytype> <frevvo:label>Zip</frevvo:label> </xsd:appinfo> </xsd:annotation> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="\d{5}|\d{5}-\d{4}"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element minOccurs="0" name="Phone"> <xsd:annotation> <xsd:appinfo> <frevvo:displaytype>Phone</frevvo:displaytype> <frevvo:label>Phone</frevvo:label> </xsd:appinfo> </xsd:annotation> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:pattern value="\d{3}-\d{4}"/> <xsd:pattern value="\d{3}\.\d{4}"/> <xsd:pattern value="\d{3}-\d{3}-\d{4}"/> <xsd:pattern value="\d{3}\.\d{3}\.\d{4}"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType> <xsd:simpleType name="StateType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="CT"/> <xsd:enumeration value="MA"/> <xsd:enumeration value="NY"/> </xsd:restriction> </xsd:simpleType> </xsd:schema>



Generating an XML Schema

First, you need to generate an xml schema that will be uploaded to 

. See the chapter Creating a Form Connected to your Database for instructions on generating a schema using the 
 Database Connector.

Using Your Schema

Before you can use global elements from a schema in a form, you must upload the schema XSD file into one of your

 projects. To upload a schema:

  1. From the Projects page, click the name of the project with the forms that will use the schema.

  2. Click Schemas from the left-hand menu.

  3. From the Schemas page, click the 

    Add icon.

  4. On the Upload Schema Page, type a meaningful name for your schema and provide a description. (These are optional but highly recommended.) The Name and Description are each limited to 255 characters.

  5. Click Browse, locate the schema XSD file or zipfile with multiple related XSDs on disk.

  6. If there are multiple global elements in the zipfile(s) specify exact name (relative to the top level directory separated by the '/' character of the XSD file containing the root schema.

  7. Click Upload.

If your schema is valid, its name now will appear on the Schemas page. You can

sort the Schemas list alpahbetically (A-Z or Z-A). If you tried to upload an invalid schema,
  will not allow the upload and display an error message.

Important notes about uploading schemas:

  1. You may add as many schemas as you require; however, you cannot have two or more data sources in your project with the same root element name.

  2. You may use global elements from uploaded schemas in any and all forms in the project.

  3. If you want to use the same schema elements in multiple projects, upload the schema to each project separately.   

  4. If your schema references another schema, you must upload all related schemas in a single zipfile.

  5. If you upload a zipfile all the schemas in the zipfile must be related.

  6. If you have unrelated schemas you must upload them individually or alone in their own zipfile.

If you add a data source (XSD) to your form/workflow that has the root element name "form" that 

uses by default for the palette control XSD, you will see an application error. To resolve, edit the form or workflow "Element Name" property and change it from the default "form" to whatever you want to call it.

Adding Elements to a Form’s Data Sources

Once you’ve uploaded your schema, the next step is to choose the global elements you want for a particular form. The elements you choose will be displayed in the form’s Data Sources area on the lower left portion of the Forms Designer. You may add the elements to as many forms as you wish, but you must work with one form at a time.
 
To add the elements to a form’s Data Sources:

  1. Open the form in the Forms Designer (by clicking the form name from the Form and Workflows Homepage).

  2. In the Data Sources area on the left side of the Forms Designer, click New from XSD

    icon.

  3. You’ll see all available schemas; click the plus sign

    to expand the schema folders and display the global elements from each.

  4. Click the

     icon next to each global element you want. If the element is a complex type, you will see the parent element only, but the child elements will be added automatically to your form’s Data Sources. You may add as many elements as you like.

After you close the page, you’ll see in the Data Sources area each element you chose. (We added the Address Book and Policy Information global elements in this example.) For each element you added to your form’s Data Sources,

 will generate an XML instance document that you will see in the Submissions repository each time users submit your form, even if you do not end up generating a control from the element. Therefore, if you add an element to your form but later determine you don’t need to generate a control from it, make sure to delete the element from the form’s Data Sources.

Adding multiple data sources from the same namespace will cause a clash in your form. And in fact

 will assist you by preventing you from making this mistake. A warning message is displayed in the Add Data Source panel when you click plus.

Similarly, multiple XSD files composing a single logical namespace is not supported. Instead, merge all XSD files for the same namespace into a single XSD file and then upload into 

.

Generating Controls from Schema Elements

Once the global elements are part of your form’s Data Sources you can generate controls for any or all of them. 

To generate a group control that automatically includes controls for all of a parent element’s children, click the icon to the right of the parent. The controls for the children elements will be inside a section control.  If the complex type has repeating items, the section will be inside a repeat control.