AnsweredAssumed Answered

Gel Script: How to Generate a CSV

Question asked by Priya12 on Jun 11, 2015
Latest reply on Jul 8, 2015 by Ben.R

Friends, I need an urgent help where I am writing a gel script to generate a CSV file based on the query result.
I am trying to generate this file on my local machine .

Issue:- I am getting all the system outputs as required.File is not getting generated.
kindly help me out .

 

<gel:script
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:core="jelly:core" xmlns:email="jelly:email"
    xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
    xmlns:ftp="jelly:com.niku.union.gel.FTPTagLibrary"
    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:util="jelly:util"
    xmlns:xog="http://www.niku.com/xog"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <gel:formatDate format="ddMMyyyy" stringVar="today"/>

  <gel:setDataSource dbId="niku"/>
       <!-- Start writing CSV file-->
    <file:writeFile delimiter="," fileName="D:\Proceeslog\2015\Clarity_Resource" >
        <gel:log category="User-defined process" level="info" message="Start " />
  <file:line>
            <file:column value="Resource_Name"/>
            <file:column value="WWID"/>
        <gel:log category="User-defined process" level="info" message="start-column defined " />
        </file:line>
        <!--User Details-->
        <sql:query escapeText="false" var="user_query">
<![CDATA[
select Resource_Name,WWID
    from
    (select srm.full_name as Resource_Name, srm.unique_name as WWID
    from srm_resources srm
    where
    srm.IS_ACTIVE=1 --and rownum<5
) temp
]]>
                                                    
  </sql:query>
        <core:forEach items="${user_query.rowsByIndex}" trim="true" var="row">
            <file:line>
  
     <gel:log category="User-defined process" level="info" message="inside file loop " />
     <file:column value="${row[0]}"/>
     <file:column value="${row[1]}"/>
  
            </file:line>
        </core:forEach>
    </file:writeFile>
<gel:log category="User-defined process" level="info" message="End of the process " />
</gel:script>

Outcomes