Scot Ranney • March 01, 2024
1. Page Items: assign "http headers" item to the page (batch report template usually)
2. Create a header:
SMT code using tab delim:
<mvt:assign name="l.delim" value="asciichar(9)" /> <mvt:assign name="l.lf" value="asciichar(10)" /> <mvt:foreach iterator="line" array="data"> <mvt:eval expr="l.row1_data $ l.delim $ l.row2_data $ l.delim $ l.row3_data $ l.lf" /> </mvt:foreach>
SMT code using comma delim and miva csv encoding:
<mvt:assign name="l.delim" value="','" /> <mvt:assign name="l.lf" value="asciichar(10)" /> <mvt:foreach iterator="line" array="data"> <mvt:assign name="l.line" value="miva_csv_encode(l.row1_data,l.delim) $ l.delim $ miva_csv_encode(l.row2_data,l.delim) $ l.delim $ miva_csv_encode(l.row3_data,l.delim) $ l.lf" /> <mvt:eval expr="l.line" /> </mvt:foreach>
CSV Headers:
You can manually put a header line on top or not, doesn't really matter if your columns are in the right order and your parsing script needs them in that order. Remember to skip the first line when importing if the file is using a header.
mvkb_header mvkb_batch