Filter Function

Top Previous Topic Next Topic  Print this topic

Filter function selects data from one input data source depending on a filter condition.

 

The sample below filters the hist table for each employee in the emp table using the current employee ID and lists the departments he worked in.

 

 

<das:job xmlns:das="http://www.ecrion.com/das/1.0" last-id="52">

 

<!--

       This filter function takes as an input a data source and a boolean function (which restricts records returned from input data source). In this sample, for each employee from the table emp, a history of the departments he worked in will be displayed. This is done by filtering the hist table for each employee using current employee ID numbers.

-->

 

 

 <!--The resulting XML structure-->

 <das:output id="7">

   <das:element id="8" name="root">

     <das:element-sequence id="1e" name="Emp" data-source="14">

       <das:element-sequence id="31" name="Departments" data-source="28">

         <das:attribute id="33" name="DEPARTMENT" value="1c"/>

       </das:element-sequence>

       <das:attribute id="26" name="ID" value="16"/>

     </das:element-sequence>

   </das:element>

 </das:output>

 

 

 <!--Table Data Sources-->

 <das:table-data-source id="14" name="Emp" connection="13">

   <das:field id="15" name="LAST_NAME"/>

   <das:field id="16" name="ID"/>

   <das:field id="17" name="FIRST_NAME"/>

 </das:table-data-source>

 

 <das:table-data-source id="18" name="Hist" connection="13">

   <das:field id="19" name="ID"/>

   <das:field id="1a" name="HOURS_WORKED"/>

   <das:field id="1b" name="EMP_ID"/>

   <das:field id="1c" name="DEPARTMENT"/>

   <das:field id="1d" name="DATE_MODIFIED"/>

 </das:table-data-source>

 

 

 <!--Filter each employee in hist table(18) after boolean function return value(2a)-->

<das:filter-function id="28" data-source="18" filter="2a"/>

 

 <das:equal-function id="29">

   <das:in-param id="2c" src="16"/>

   <das:in-param id="2b" src="1b"/>

   <das:return-value id="2a"/>

 </das:equal-function>

 

 <das:database-connections>

   <das:database-connection id="13" connection-string="#connectionString" data-driver-type="DotNet" provider-name="System.Data.OleDb" description="MSACCESS:CONNECTION1"/>

 </das:database-connections>

 

</das:job>

 

 

 

Note. This sample can be found in Samples\Job Samples folder.

 

Attributes:

id - unique identifier of this resource in the current processing job.

data-source - input data source.

filter - boolean condition for filtering data from the input data source.