...
Expand |
---|
title | Click here for an example |
---|
|
Code Block |
---|
| <?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> |
|
Excerpt |
---|
Generating the XML schemaYou can use the database connector to generate the schemas you will need to use in your form. To fetch the schema, type a URI in the browser that looks like the example below. This is almost identical to the query we used to test the connector, but it tells the connector to GET the schema instead. Code Block |
---|
| http://<host>:<port>/database/<queryset name>/<query name>/schema?<template name>=<template value> |
If your SQL Retrieve statement includes template variables, you’ll need to add the variable names as shown below. The schema itself does not require variables but the connector fetches the schema the same way it fetches data for the retrieve statement, so the connector expects the template names and values in the URI. For the example we've been using so far, point your browser to the url: http://localhost:8082/database/BIRT/allCustomers/schema?customerNumber=237 You should get an XML schema similar to the following: Code Block |
---|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns="http://www.frevvo.com/database/allCustomers" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.frevvo.com/database/allCustomers">
<xsd:annotation>
<xsd:appinfo xmlns:f="http://www.frevvo.com/database/" f:connectorVersion="2.5.3-r30969" f:digest="4f2c46033e8ff5a221ab7106c4003833157e7f6a" f:last-modified="Sat Aug 19 19:06:45 EDT 2017" source="http://www.frevvo.com/database/"/>
</xsd:annotation>
<xsd:element name="allCustomers">
<xsd:annotation>
<xsd:appinfo xmlns:f="http://www.frevvo.com/database/" f:autoCreate="true" f:autoDelete="false" f:enabled="true" source="http://www.frevvo.com/database/"/>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="row">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="customerNumber" type="xsd:int"/>
<xsd:element name="customerName">
<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>
|
Note |
---|
The f:connectorVersion="2.5.3-r30969 attribute in the above example reports the version of the Database Connector that was used to generate the schema. The f:last-modified="Sat Aug 19 19:06:45 EDT 2017 attribute reports the date/time of the last modification to your configuration.xml file. These attributes will help you manage xsd changes. |
Save the schema as an .xsd file in your file system. Note |
---|
Your schema may not work correctly if you generated the schema in the Chrome browser and then used the Select All, copy/paste function to create the xsd file. Use the Save Page As function instead. |
You can then upload the schema to and generate controls from the schema elements that map to your database tables. If you have multiple queries in your configuration file, you have two options: Generate the schemas for an entire queryset. When there are a large number of queries in the configuration.xml, getting the schemas for all of them eliminates having to create a schema one by one for each query. The queryset schema can be uploaded to your project one time and then you can add the relevant schema elements to your forms/workflows as you need them. Code Block |
---|
http://<server>:<port>/database/BIRT/schema |
Generate a schema for each query. Code Block |
---|
http://<server>:<port>/database/BIRT/allCustomers/schema |
Tip |
---|
The word "schema" is a reserved word for query names. If you have a query in your configuration.xml with a name that includes the word "schema" will show an error. |
|
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:
...