Versions Compared

Key

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

...

Name

Type

Cardinality

parameter

urn:com.cohga.server.data.database#1.0:parameter

0..n

cache

urn:com.cohga.server.cache#1.0:cache

0..1

fromurn:com.cohga.server.data.database#1.0:from0..n
whereurn:com.cohga.server.data.database#1.0:where0..n
sorturn:com.cohga.server.data.database#1.0:sort0..n
joinurn:com.cohga.server.data.database#1.0:join0..n

...

Name

Type

Required

Description

clause

string

yes

An additional clause to include in the generated SQL

uppercase

boolean

no

If the clause uses parameter substitution should the value be converted to upper-case before being substituted

Sub-tags

None

Content

None

join

Only available in 2.5.11 or later

properties

sort

Properties

Name

Type

Required

Description

table

parameter

string

yes

The table to join to
onstringyesThe clause used to join the table
typestringnoThe type of join to use

 

 

Examples

...

Name of parameter to sort on

direction

string

no

ASC or DESC, ASC is default

Sub-tags

None

Content

None

join

Only available in 2.5.11 or later

properties

NameTypeRequiredDescription
tablestringyesThe table to join to
onstringyesThe clause used to join the table
typestringnoThe type of join to use

 

 

Examples

Code Block
xml
xml
titleBasic data definition where output is based on columns in the underlying table
linenumberstrue
<data:datadefinition id="roadDetails">
	<datasourcedataconnection datasource="datasource.main" table="ROADS" key="RD_NAME" prefix="DISTINCT"/>
</data:datadefinition>

...

Code Block
xml
xml
linenumberstrue
<data:cache id="test">
	<setting>value</setting>
	<setting>value</setting>
	<setting>value</setting>
</data:cache>

<data:datadefinition id="...">
	<datasourcedataconnection ...>
		...
		<cache id="test"/>
	</datasourcedataconnection>
</data:datadefinition>

Using a temporary table

Code Block
languagexml
titleUsing a temporary table
	</datasourcedataconnection>
</data:datadefinition>

Using a temporary table

Code Block
languagexml
titleUsing a temporary table
<data:datadefinition id="roadDetails">
	<datasourcedataconnection datasource="datasource.main" table="ROADS" key="RD_NAME" prefix="DISTINCT" keytable="ROADS_SELECTION" keycolumn="RD_NAME" usercolumn="UID">
		<from table="PLANS"/>
		<where clause="PLANS.ID=ROADS.PLAN_ID"/>
		<parameter name="name" label="Name" column="RD_NAME"/>
		<parameter name="suffix" label="Suffix" column="RD_SUFFIX"/>
		<parameter name="type" label="Type" column="RD_TYPE"/>
		<parameter name="altname" label="Alt. Name" column="ALT_NAME"/>
		<parameter name="altsuffix" label="Alt. Suffix" column="ALT_SUFFIX"/>
		<parameter name="alttype" label="Alt. Type" column="ALT_TYPE"/>
		<parameter type="integer" name="class" label="Class" column="CLASS_CODE"/>
		<parameter type="url" name="plan" label="Plan" column="'http://imgsvr:8080/gis/documents/plan_'||PLANS.PLAN_CODE||'.pdf'" text="Open"/>
		<cache disable="true"/>
	</datasourcedataconnection>
</data:datadefinition>

This example will utilise a temporary table called ROADS_SELECTION which contains two columns RD_NAME who's data type matches the RD_NAME column in the ROADS table, and UID which is a varchar column long enough to contain 32 random characters, and there should be an non-unique index on the UID column.

Sorting data

You can add <sort> tags to specify what column(s) to sort by by default, e.g.

Code Block
<data:datadefinition id="roadDetails">
	<datasourcedataconnection datasource="datasource.main" table="ROADS" key="RD_NAME" prefix="DISTINCT" keytable="ROADS_SELECTION" keycolumn="RD_NAME" usercolumnprefix="UIDDISTINCT">
		<from table="PLANS"/>
		<where clause="PLANS.ID=ROADS.PLAN_ID"/>
		<parameter name="name" label="Name" column="RD_NAME"/>
		<parameter name="suffix" label="Suffix" column="RD_SUFFIX"/>
		<parameter name="type" label="Type" column="RD_TYPE"/>
		<parameter name="altname" label="Alt. Name" column="ALT_NAME"/>
		<parameter name="altsuffix" label="Alt. Suffix" column="ALT_SUFFIX"/>
		<parameter name="alttype" label="Alt. Type" column="ALT_TYPE"/>
		<parameter type="integer" name="classaltsuffix" label="ClassAlt. Suffix" column="CLASSALT_CODESUFFIX"/>
		<parameter type="url" name="planalttype" label="PlanAlt. Type" column="'http://imgsvr:8080/gis/documents/plan_'||PLANS.PLAN_CODE||'.pdf'" text="Open"/>
		<cache disable="trueALT_TYPE"/>
		<sort parameter="type"/>

		<sort parameter="name"/>
	</datasourcedataconnection>
</data:datadefinition>

...

New Join Syntax

As of Weave 2.5.11 it's possible to specify a table join using join specific tag (rather than having to use from and where tags).

...