Each database table is defined with a table tag. You need to specify a unique id and a name. Contained in the table tag are a set of column definitions. Each column has a name which ends up being the database column name so this should be legal sql. There is also a label and some flags, e.g. cansearch, canlist, that determine whether the column is shown in the list and in the search form.
The column also has a type, e.g.:
string enumeration enumerationplus date datetime double int latlon latlonbbox clob emailIf its an enumeration then you also have to specify a column separated list of values. See the prioriity example below. The enumerationplus type allows the user to enter their own value and/or use values that have already been created. If its a string or a clob then you also need to specify a size (byte size)
Here is a tasks data table -
<table id="tasks" name="Tasks" icon="/db/tasks.gif"> <column name="title" type="string" label="Title" cansearch="true" canlist="true" required="true"/> <column name="priority" type="enumeration" label="Priority" values="High,Medium,Low" cansearch="true" canlist="true"/> <column name="status" type="enumeration" label="Status" values="Not Started,In Progress,Completed,Deferred,Waiting" cansearch="true" canlist="true"> <property name="iscategory" value="true"/> </column> <column name="complete" type="percentage" label="% Complete" cansearch="true" canlist="true"/> <column name="assignedto" type="enumerationplus" values="" label="Assigned To" cansearch="true" canlist="true"> <property name="iscategory" value="true"/> </column> <column name="description" type="string" label="Description" canlist="false" rows="5" columns="40" size="10000" /> <column name="startdate" type="date" label="Start Date" cansearch="true" canlist="true"/> <column name="enddate" type="date" label="End Date" cansearch="true" canlist="true"/> </table>Column tags can also contain property tags If a column tag has a property tag iscategory then the categorical views are shown, e.g.:
<column ...> <property name="iscategory" value="true"/> </column>If a column has a "label=true" property, e.g.:
<property name="label" value="true"/>then that column value is used as the label for the entry
<tables> <table id="airplane_crashes" name="Airplane Crashes" icon="/db/database.png" > ... <template id="t1" name="Template 1" mimetype="text"> <contents> <![CDATA[ <h2>Crash</h2> Date: ${date}<br> Location: ${location}<br> Operator: ${operator} ]]> </contents> <prefix> <![CDATA[ <h1>Crashes</h1> ]]> </prefix> <suffix> <![CDATA[ End ]]> </suffix> </template> </table> </tables>
table.db.databases=employees,menagerieFor each of the named databases there needs to be specified the JDBC url and the username/password. e.g.:
table.db.menagerie.url=jdbc:mysql://geodesystems.com:3306/menagerie?zeroDateTimeBehavior=convertToNull&initialTimeout=1000&connectTimeout=5000 table.db.menagerie.user=db user table.db.menagerie.password=db user password table.db.employees.url=jdbc:mysql://geodesystems.com:3306/employees?zeroDateTimeBehavior=convertToNull&initialTimeout=1000&connectTimeout=5000 table.db.employees.user=db user table.db.employees.password=db passwordOnce the databases are define you can create an entry for a particular table in the database. Under the File->Pick a Type->Choose Entry Type select "External Database" under the "Database" category. When initially creating the entry you select which database is to be used, e.g., "employees". Once the entry is created go back and edit it. Now there will be a menu that lists all of the tables in the selected database. Once created the External Database entry can act as a source of point data and can be used to create displays. Database table fields can be configured to be able to be used in the display filter specifications. When editing the entry add the following properties in the Properties field:
#This says that the particular field can be used in the display request.<field name>.display=true e.g.: request.gender.display=true #This says that all fields can be used in the display request.*.display=true #This defined the field as an enumeration request.<field name>.type=enumeration e.g.: request.gender.type=enumeration