About the Carriage Return(CR) and Line Feed (LF) by file:line tag in GEL script
search cancel

About the Carriage Return(CR) and Line Feed (LF) by file:line tag in GEL script

book

Article ID: 200865

calendar_today

Updated On:

Products

Clarity PPM SaaS Clarity PPM On Premise

Issue/Introduction

The Line Feed (LF) is written by <file: line> tag in GEL script.
The Carriage Return (CR) is not written.
Is it possible to change to use CRLF?

 

Environment

Release : All versions

Component : CA PPM SAAS APPLICATION

Resolution

CR, LF can be used in GEL script by using the below characters.
CR :  &#013;
LF :  &#010;

There is a sample gel script code to output text file.

-----------------------------
<gel:script 
  xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
  xmlns:ftp="jelly:com.niku.union.gel.FTPTagLibrary"
  xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
  xmlns:core="jelly:core">

 <core:set value="ABCDEFG" var="S1"/>
<core:set value="HIJKLMN" var="S2"/>

 <file:writeFile fileName="c:/temp/test.txt" delimiter=""  embedded="false">
   <file:line>
        <file:column value="${S1}"/>
   </file:line>    
   <file:line>
        <file:column value="${S2}"/>
   </file:line>    
 </file:writeFile>
</gel:script>
-------------------------

Open the created file by using notepad.

Open this file by using binary editor. The "0A" is used. (0A means LF)

Changed GEL script like as below to add CR.

-----------------------------
<gel:script 
  xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
  xmlns:ftp="jelly:com.niku.union.gel.FTPTagLibrary"
  xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
  xmlns:core="jelly:core">

 <core:set value="ABCDEFG" var="S1"/>
<core:set value="HIJKLMN" var="S2"/>

 <file:writeFile fileName="c:/temp/test.txt" delimiter=""  embedded="false">
   <file:line>
        <file:column value="${S1}&#013;"/>
   </file:line>    
   <file:line>
        <file:column value="${S2}"/>
   </file:line>    
 </file:writeFile>
</gel:script>
-------------------------

Open the created file by using binary editor. The "0D" and "0A" are used. (0D means CR, 0A means LF)