Data link in Data Template

If you have multiple queries, you must link them to create the appropriate data output. In the data template, there are two methods for linking queries: using bind variables or using the <link> element to define the link between queries.

One way for doing it is using Bind variable. But sometimes this method may not work.

Eaxample

<dataQuery>
<sqlStatement name=”Q1″>
<![CDATA[
SELECT DEPTNUM,DNAME,LOC
from scott.dept
order by deptno ]]>
</sqlStatement>
<sqlStatement name=”Q2″>
<![CDATA[
SELECT DEPTNO, EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,nvl(COMM,0) COMM
from scott.EMP
where DEPTNO = :DEPTNUM ]]>
</sqlStatement>
</dataQuery>

 

 

Using Link

<link name=”DEPTEMP_LINK” parentQuery=”Q1″ parentColumn=”DEPTNO” childQuery=”Q_2″¬†childColumn=”DEPARTMENTNO”/>

 

Example

<dataQuery>
<sqlStatement name=”Q1″>
<![CDATA[
SELECT DEPTNO,DNAME,LOC from scott.dept
order by deptno ]]>
</sqlStatement>
<sqlStatement name=”Q2″>
<![CDATA[
SELECT DEPARTMENTNO, EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,nvl(COMM,0) COMM
from scott.EMP ]]>
</sqlStatement>
<link name=”DEPTEMP_LINK” parentQuery=”Q1″ parentColumn=”DEPTNO” childQuery=”Q_2″ childColumn=”DEPARTMENTNO”/>
</dataQuery>

 

			

Data Template error :The uploaded file is invalid. the file should be in xml-data-template format

While defining Data Definition

Error:
The uploaded file is invalid. the file should be in xml-data-template format.

Solution : Check if the Data Template XML file that is being uploaded is in proper XML format. Try opening the file in IE and check if it is coming in proper format or erroring out(or not in proper format).