Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
 <?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.frevvo.com/database/customers" xmlns:xsd="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://www.frevvo.com/database/customers">
  <xsd:element name="customers">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element maxOccurs="unbounded" name="row">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="customerId">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="11"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element minOccurs="0" name="firstname">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="50"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
              <xsd:element minOccurs="0" name="lastname">
                <xsd:simpleType>
                  <xsd:restriction base="xsd:string">
                    <xsd:maxLength value="50"/>
                  </xsd:restriction>
                </xsd:simpleType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

...

  1. Click on the Doc Action button in the toolbar at the top of the form.
  2. In the dialog box that appears click on 'Manually set document URIs'.

[[image:DocActionDocURItab.png]]Image Added

The first screen in the wizard is for the form's default document. This is indicated by the Document Name of "default" displayed in the wizard. The default document maps to all of the controls you added to this form by dragging a dropping from the palette. This is typically not the document you want to configure.

  1. Click the Next button to advance from the default document to the next schema document
  2. You should see the Document name change your schema's document name
  3. Enter the database connector Url to your query in the wizard's URL input. If the database connector is running in the same host and port as the frevvo form server, then you can omit http://<host>:<port>/ from the URL. See this example below.

[[image:DocActionDocURItabSetDoc.png]]Image Added

You also must specify which of the four SQL statements to run—you do this by choosing the appropriate values in the Document URI Read Method and Document URI Write Method dropdowns according to the table below. (You may notice in the Forms Designer that the Document URI Read Method drop down box includes a POST option, but it is not shown below because it is not used by the database connector.)

...

SQL Statement TypeDocument URI Read MethodDocument URI Write Method
CreateLeave blankPOST
RetrieveGET (or leave blank if you are not retrieving data)Leave blank if your form is read-only
UpdateLeave BlankPUT
DeleteLeave BlankDELETE
Code Block
<table>
<table cellpadding="3" cellspacing="0" border="1">
<tr> <th>SQL Statement Type</th> <th>Document URI Read Method</th> <th>Document URI Write Method</th></tr>
<tr> <td>Create</td> <td>Leave blank</td> <td>POST</td></tr>
<tr> <td>Retrieve</td> <td>GET (or leave blank if you are not retrieving data) </td> <td>Leave blank if your form is read-only</td></tr>
<tr> <td>Update</td> <td>Leave Blank</td> <td>PUT</td></tr>
<tr> <td>Delete</td> <td>Leave Blank</td> <td>DELETE</td></tr>
</table>

You’ll see one set of Document URI properties '''for each schema''' in your form. Type the Document URI next to the schema name—make sure '''not''' to type it next to the Default schema. To specify which of the four SQL statements to run, choose the appropriate values in the '''Read Method''' and '''Write Method''' dropdowns, based on the information below. 

  • Read Method - Choose GET if your form will be initialize with data from your database; leave the dropdown blank if it won’t. (Don’t set the Read Method to POST; this is used for integrating forms with different back ends.) 
  • Write Method - If your form is read-only, leave this blank. Otherwise, use the chart above chose either PUT or POST. PUT maps to the '''update''' method while POST maps to '''create'''.

Note that you may choose only one Write Method in the Forms Designer.

...

If you choose the Write method to be ''POST'', the SQL statement that will be executed is:

...

When a user loads your form, a GET request for that URI will be sent to the database connector. That will cause the database connector to execute the '''retrieve''' operation for the query specified in the URI, take the result of the SQL execution and transform it to XML. The database connector will than return the resulting XML back to the form which will be initialized with the contents of the XML file.

When the user submits the form, the same URI will be executed but now with the PUT (or POST) method. The database connector will than execute the '''updade''' operation identified by that URI.

...

The control you generate from the initial schema will be formatted as a text control.  You can make the control a dropdown by changing the control’s '''Format As''' Display As property but you must add the actual restrictions to the schema itself, as shown below. 

...

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.frevvo.com/database/Customer" targetNamespace="http://www.frevvo.com/database/Customer">    <xsd:element name="Customers">       <xsd:complexType>
         <xsd:sequence>
            <xsd:element maxOccurs="unbounded" name="row">                <xsd:complexType>
                  <xsd:complexType> <xsd:sequence

Since the schema says the element is unbounded, the control you generate initially will be a repeat control.  You’ll see the Repeat Row heading in the Forms Designer and if you don’t make any changes, users will see the + sign that comes with repeat controls.

...

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.frevvo.com/database/Customer" targetNamespace="http://www.frevvo.com/database/Customer">    <xsd:element name="Customer">       <xsd:complexType>
         <xsd:sequence>
            <xsd:element maxOccurs="1" name="row">                <xsd:complexType>
                  <xsd:sequence>

Note that now maxOccurs="1" and that will force the + sign to disappear.

...