Copy link to clipboard
Copied
Hello, all.
I'm trying to get confirmation files to upload to Amazon for their "Charge When Ship" program. I've got the file creating as it should be with one minor exception.
I'm setting a variable, giving it the header column information and ending that with chr(13) & chr(10); then I'm looping through a query to add the information, each iteration tacks chr(13) & chr(10) to the end of it; then I'm taking that variable and writing the data to a file using CFFILE.
But I think that the last chr(13) & chr(10) is causing Amazon servers to think there's one more line of information than there really is, and it's erroring.
Can anyone tell me how to remove that last chr(13) & chr(10) from the variable before writing it to file?
Thanks,
^_^
giving it the header column information and ending that with chr(13) & chr(10); then I'm looping through a query to add the information, each iteration tacks chr(13) & chr(10) to the end of it; then I'm taking that variable and writing the data to a file using CFFILE.
Trim() the variable or change the code so it does not generate an extra new line.
Since your content has a header, place the new line characters at the beginining of each query iteration.
#headerColumnsHere# <!--- notice there is no
...Copy link to clipboard
Copied
giving it the header column information and ending that with chr(13) & chr(10); then I'm looping through a query to add the information, each iteration tacks chr(13) & chr(10) to the end of it; then I'm taking that variable and writing the data to a file using CFFILE.
Trim() the variable or change the code so it does not generate an extra new line.
Since your content has a header, place the new line characters at the beginining of each query iteration.
#headerColumnsHere# <!--- notice there is no new line after the column header information --->
<cfouput query="yourQuery">#chr(13)##chr(10)# #ColumnA##ColumnB#...etcetera...</cfoutput>
Copy link to clipboard
Copied
Using trim() did not remove the last line break from the string (nor did I expect it to; it really just removes spaces.)
However, when I read your suggestion to place the line breaks at the beginning of the output lines, I almost knocked myself unconscious smacking myself in the forehead. I was looking for a complex solution, I didn't see the simple one that was right in front of me. Thanks for pointing this out, to me. I really appreciate the solid thinking behind that one.
^_^