csv

Post Reply
sourceuno
Posts: 225
Joined: Mon Apr 09, 2001 3:58 pm

csv

Post by sourceuno »

I'm trying to create a csv by using fmt to create a string for each row. I want to create a date field in a certain format. If I leave the code in there to do this, my output file seems is double spaced (each row on every other line). But if I take that code out, the output appears correctly. What am I doing wrong?

<SQL ROW "select field1,field2,field3 from mytable where field1=$qryval">
<sandr " " " " $field3>
<sandr " " " " $ret>
<sandr "|" "" $ret>
<$newfield3=$ret>

<!-- if i remove this if statement, output file is correct -->
<if $field1 ne 'NULL'>
<strfmt "%m/%d/%y" $field1>
<$newfield1=$ret>
</if>

<fmt "%s|%s|%s\n" $field1 $field2 $field3>

</sql>
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

csv

Post by mark »

Remove the blank lines. Most extra whitespace gets stripped from the output but lone newlines go through. When generating data where spacing is important don't use any blank lines.
sourceuno
Posts: 225
Joined: Mon Apr 09, 2001 3:58 pm

csv

Post by sourceuno »

I'm not really sure what's causing the blank lines. Are you saying that I should check if all the fields are empty first before sending them to fmt?
User avatar
Kai
Site Admin
Posts: 1272
Joined: Tue Apr 25, 2000 1:27 pm

csv

Post by Kai »

No, remove the blank lines in your Vortex code, before the "<!-- if i remove this ..." comment, after the "</if>", and after the last "<fmt ..." statement. Those are being output by Vortex because any non-statement text -- such as those newlines -- is output as-is. (the exception is horizontal whitespace before a statement, and the first newline after a statement).
Post Reply