shalinee

Issue in pipe seperated file created via GEL

Discussion created by shalinee on Sep 26, 2012
Latest reply on Oct 10, 2012 by shalinee
Hi All,

I have created a gel script to create a pipe separated file on server. The gel code is working fine and It is creating the file while the file is not entering the new row in new line. It is writing the output continuously while I need to put a new line command after each row output. Looks like I am missing some small syntax here....

This is my Code------

<gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:core="jelly:core"
xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:sql="jelly:sql">

<gel:parameter default="C:\Program Files" var="filePath"/>
<gel:parameter default="testdata.txt" var="infile"/>

<gel:setDataSource dbId="niku" var="a"/>

<sql:query dataSource="${a}" var="result">
select 'IdeaID' Idea_Code, 'Description' name,'CostCenter' cc,
'Type' Project_Class,
'SecurityLevel' Security_Level,
'Status' status,'JCode' jcode,'Stage' stage,'Phase' phase
from dual
union
select i.code Idea_Code, i.name name,
p.ahm_idea_isd_cc cc, p.ahm_req_category Project_Class,p.ahm_idea_sec_level Security_Level,
(CASE i.is_active WHEN 1 THEN 'Active' ELSE 'Inactive' END ) Status,
p.ahm_idea_jcode jcode,
p.ahm_sr_status stage,
p.ahm_idea_phase phase
from
inv_investments i, odf_ca_idea p
where i.id = p.id
and p.ahm_req_category='Project'
and p.ahm_funding_status='approved'
order by 3 desc
</sql:query>

<!-- Write a file locally -->
<file:writeFile fileName="${filePath}/${infile}" delimiter="|" embedded="false">

<!-- Add a Detail record to the file -->
<core:forEach items="${result.rowsByIndex}" var="row">
<file:line>
<file:column value="${row[0]}"/>
<file:column value="${row[1]}"/>
<file:column value="${row[2]}"/>
<file:column value="${row[3]}"/>
<file:column value="${row[4]}"/>
<file:column value="${row[5]}"/>
<file:column value="${row[6]}"/>
<file:column value="${row[7]}"/>
<file:column value="${row[8]}"/>
</file:line>
</core:forEach>
</file:writeFile>
</gel:script>


The output file is attached here.

while the desire of output file is

IdeaID|Description|CostCenter|Type|SecurityLevel|Status|JCode|Stage|Phase
I07828|Governance: Security Request System|4733|Project|Public|Active|null|Hold|Not Started
I07830|Security: Data Power Device Migration|4733|Project|Public|Active|J02426|Active|null
I07897|Global Team Working (J0,J1-J5)|4733|Project|Public|Active|J02422|Hold|null
I09090|Next Generation Architecture (NGA)|4733|Project|Sensitive|Active|J02377|Active|null
I12320|Managed File Transfer|4733|Project|Sensitive|Active|J02493|Active|null
I02959|iNPLUS Realtime Sales Integration|4732|Project|Public|Active|J02144|Completed|null
I05330|Sell Thru Alert Message and Report|4732|Project|Public|Active|null|Completed|null
I06837|iN to Support Multiple Internet Browsers -|4732|Project|Public|Active|J02504|Active|null
I11079|iNPlus Realtime Tier II|4732|Project|Sensitive|Active|J02484|Active|null
I11142|Dealer Mobile|4732|Project|Sensitive|Active|J02491|Active|null
I11144|READS (Retention Equals Advanced Data Sharing)-Scope only|4732|Project|Sensitive|Active|J02495|Active|null

Thanks in advance

Outcomes