AnsweredAssumed Answered

Email notification - Gel-Script

Question asked by npara on Jun 5, 2013
Latest reply on Jun 6, 2013 by rayd_indian
Hi All,

I have a gel-script which should send out notification if the executed query in the script as a result set, or it should send out email that there are no results.

But the below script is sending out email as ‘no results’ even though the executed query is having some result set.

Please help

Gel-script.
<gel:script
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="jelly:sql"
xmlns:mail ="jelly:email"
xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ftp="jelly:com.niku.union.gel.FTPTagLibrary"
xmlns:file="jelly:com.niku.union.gel.FileTagLibrary">

<gel:setDataSource dbId="niku"/>
<sql:query var="results">
select i.name Project_Name,i.code Project_Code , @@ROWCOUNT no_of_rows
from INV_INVESTMENTS i
inner join ODF_OBJECT_INSTANCE_MAPPING o on i.ID = o.PRIMARY_OBJECT_INSTANCE_ID
inner join FIN_FINANCIALS f on o.SECONDARY_OBJECT_INSTANCE_ID = f.ID
inner join odf_ca_project od on i.ID = od.id
</sql:query>

<core:choose>
<core:when test="${row[0].no_of_rows >0}">
<gel:log level="info" category="User-defined process" message="Query returned."/>
<mail:email from="xyz@email.com" to="xyz@email.com" subject="Projects Fields'" server="xzy.email.com" >


Team,


Please find the below list of Projects which has Budget Fields mismatch.

<core:forEach items="${results.rowsByIndex}" var="row">

<core:set value="${row[0]}" var="Project_Name"/>
<core:set value="${row[1]}" var="Project_Code"/>

Project Code: ${Project_Code} Project Name: ${Project_Name}

</core:forEach>

Regards
Clarity Administrator

</mail:email>
</core:when>
<core:otherwise>
<mail:email from="xyz@email.com" to="xyz@email.com" subject="Projects Fields'" server="xzy.email.com" >

There are no mismatch in Budget fields.

Regards
Clarity Administrator

</mail:email>

</core:otherwise>
</core:choose>
</gel:script>

Outcomes