Page 1 of 1

csv

Posted: Wed May 30, 2001 3:25 pm
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>

csv

Posted: Wed May 30, 2001 4:00 pm
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.

csv

Posted: Wed May 30, 2001 4:07 pm
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?

csv

Posted: Wed May 30, 2001 4:23 pm
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).