Complex CSV export part 2 - the attack of the spurrious invisible characters
John W. Scott
john at dharmarose.com
Tue Jul 29 07:43:01 PDT 2008
I am still banging my head on my desk over this one. I enclosed the
entire output string in a stripprinatble function per Jim's
suggestion, with great confidence that the problem was solved. The
example creates a csv list of options; in this case of one or more
sizes for shirts:
{stripprintable(?((ÇSizeShortÈ "") AND (ÇItemSeqÈ = 1), '
"' + ÇDR ItemÈ + 'sizes"' + ',"Size","' + ÇSizeÈ + ?(Çsize diffÈ =
0.00, "", "<+" + str(Çsize diffÈ) + ">") + "<sku:-" + ÇSizeShortÈ +
"><NoTitle>" +'"',"") + ?((ÇSizeÈ "") AND (ÇItemSeqÈ 1), ',"' +
ÇSizeÈ + "<+" + str(Çsize diffÈ) + "><sku:-" + ÇSizeShortÈ +
"><NoTitle>" +'"',""))}
Unfotunately, I am still getting the (seemingly) random-length string
of null characters at the end of some lines (each line can be
composed of more than one record). The null characters always appear
at the end of the line, and never embedded within a line.
I also tried saving the entire file as csv text to find null or other
invisible characters and determine in which fields they reside, but
that export appears devoid of invisibles.
The following line is an example of a multi-record output and had 8
nulls just before the return character:
"SDTWBSPKsizes","Size","Youth Small 2-4<sku:-YS><NoTitle>","Youth
Medium 6-8<+0.00><sku:-YM><NoTitle>","Youth Large 10-12<+0.00><sku:-
YL><NoTitle>"
This one was created from a single record (only one size is available
for this item, so there is only one option) and had 17 nulls:
"MTMJ90WTsizes","Size","Junior Large<sku:-JL><NoTitle>"
I tried deleting the offending records from the database that create
the first option with null chars: the null string moves up to the
previous record each of the dozens of times I tried this. If I do it
enough times, the null string drops a single null char Ñ this
happened twice dropping progressively from nine to seven null
chars). (I also tried deleting the option-records after the
offending ones (those that created the line with null chars); that
did not affect their appearance.)
I worked my way up my database, deleting records and re-outputting
and this happened every time. When I deleted the first record, the
null string jumped up one line to the line that describes the option
format. This line is created in a group header and contains no data.
;UniqueName,DisplayName,Tag1,Tag2,...,Tag n,,,,,,,,,,,,,,,,,
Finally, when I delete the group header from the form, the very first
line (which is blank) contains the null string. (Each new line is
created when a new record that contains an option, and is the first
record for a new item is encountered.)
While I have a better grasp of what is not causing the mysterious
null strings, but feel no closer to solving them.
Any more ideas?
More information about the Qna
mailing list