Skip to content

MvEXPORT#


Appends a single line of data to an external output file in the data folder, at the end of the output file, on a new line. It does not automatically loop.

Syntax
<MvEXPORT FILE = "string: {  expression } | literal"
          FIELDS = "{ expression } | variable list"
          DELIMITER = "string: {  expression } | literal"> 

Designed for exporting flat file information <MvEXPORT> can be used to export database files or other information in a delimited format. Unlike <MvIMPORT>, <MvEXPORT> does not automatically loop.


Attributes#

Attribute Description
FILE Path and file name relative to the data folder.
FIELDS Comma-separated list of variables. If null, only the delimiter value will be written.
DELIMITER Delimiter can be null, a single character, or multiple characters. If null, only the FIELDS value will be written.

Examples#

This example writes a single line of data to an output file. If the file does not exist, it will be created the first time the command is executed.

Single Line Export
<MvEXPORT FILE="{ l.months }"
          DELIMITER="{ l.tab }"
          FIELDS="var1,var2,var3">

This example writes a header line then loops through an open products database, outputting three variables on each line. New lines are appended to the end of the file.

Looping Export
<MvASSIGN NAME="l.tab" VALUE="{ asciichar(9) }">

<MvEXPORT FILE="{ l.flat_product_file }"
          DELIMITER=""
          FIELDS="l.header_export">

<MvWHILE EXPR="{ NOT products.d.eof }">
    <MvEXPORT FILE="{ l.flat_product_file }"
              DELIMITER="{ l.tab }"
              FIELDS="products.d.id,products.d.code,products.d.name">
    <MvSKIP NAME="products" ROWS="1">
</MvWHILE>

Resulting file:

1,ks0421,Kiki Shirt
4,ps0121,Polo Shirt
etc.

Writes a single line of data to an external output file.