Hi All,
Could you please help on my below issue .
In this script i am reading csv file then passing the o/p as input to sql script but from the <gel:out> I am getting the results of the last record in the csv file .My guess here is result variable is holding the last record from the select statement and its resulting the o/p (<gel:out> of the last record of the csv file.
I have tested by replacing the select with update statement its working fine .
<gel:script xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:files="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:sql="jelly:sql">
<gel:setDataSource dbId="Niku"/>
<gel:parameter var="vFileName" default="ok1.csv"/>
<files:readFile fileName="${vFileName}" delimiter="," var="vResourceData" embedded="false"/>
<core:forEach items="${vResourceData.rows}" var="row" begin="0" end="10">
<core:set var="A" value="${row[0]}"/>
<sql:query escapeText="0" var="result">
<![CDATA[
SELECT u.first_name firstName,
u.last_name lastName,
u.user_name userName
FROM cmn_sec_users u
WHERE u.user_name in('${A}')
]]>
</sql:query>
</core:forEach>
<core:forEach items="${result.rows}" trim="true" var="row">
<gel:out>${row.firstName}</gel:out>
<gel:out>${row.userName}</gel:out>
</core:forEach>
</gel:script>
Many thanks .
Regards,
Udaya kumar k