Sample template text to create CSV from DataReader Destination

Sample template text to create CSV from DataReader Destination

In the Template Editor dialog, check the 'Remove Newline' parameter. The Current object below implements the standard ADO.NET IDataReader interface.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#macro( main $reader )
#set( $schemaCols = $reader.Current.GetSchemaTable().Rows )
## Setup header.
#set( $comma = false )
#foreach($col in $schemaCols)
#if( $comma )
,
#else
    #set( $comma = true )
#end
$col.ColumnName
#end
#newline()
## Setup data.
#foreach($row in $reader)
#set( $comma = false )
#foreach($col in $schemaCols)
#if( $comma )
,
#else
    #set( $comma = true )
#end
$row.get_Item($col.ColumnName)
#end
#newline()
#end
#end
#main( $reader )


    Book a Presales Call

     

    Are you new to COZYROC and evaluating our solutions? 
    Book a Presales Call with us now.