Skip to content

Data Components

Data Components are relatively simple to define, just define the tables you want to include, their relationships if any and DATASTAR will automatically determine the columns. You only need to define key columns and columns where you require special behavior. The top level structure is shown below, the root element being Data Component.

Example Component Template

<?xml version="1.0" encoding="utf-8"?>
<DataComponent Category="reports" Name="${filename}" DeleteEnabled="true">
  <Option Name="ANSI_WARNINGS" Value="OFF"/>
  <Option Name="NOCOUNT" Value="ON"/>
  <Option Name="DATEFORMAT" Value="ymd"/>
  <Table Id="1" Name="REPORT">
    <Column Name="ID" PrimaryKey="true" Generator="EXEC dbo.GET_ID 1, @ID output"/>
    <Column Name="NAME" AlternativeKey="true"/>
    <Filters>
      <Value Column="NAME" Value="${name}"/>
    </Filters>
  </Table>
  <Table Id="2" Name="REPORT_GROUP">
    <Column Name="ID" PrimaryKey="true" Transient="true"/>
    <Column Name="GROUP" PrimaryKey="true" Transient="false" SortOrder="1"/>
    <JoinTable ReferenceId="1" Relationship="ManyToOne">
      <JoinColumn Column="ID" ReferenceColumn="ID"/>
    </JoinTable>
  </Table>
  <DynamicQuery>
    <![CDATA[
        select lower(NAME) as '${filename}', NAME as '${name}' from REPORT
    ]]>
  </DynamicQuery>
  <Deployment Weight="1000"/>
</DataComponent>