Command Line Parameters

The Database Export Wizard can be started with command line parameters for specifying workspace, file number or file name and/or field numbers. When the wizard is started from Database Explorer command line options are used.

Workspace

Specify a workspace as WS=[NAME]. The brackets are required. Sample WS=[ORDER]

File Name or File Number

Specify a file number as FILENUM=[NUMBER]. The brackets are required. Sample FILENUM=[21]

Specify a file name as FILENAME=[NAME]. The brackets are required. Sample FILENAME=[VENDOR]

Fields

Specify field numbers as FIELDS=[.NUMBER..NUMBER.]. The brackets and dots are required. Sample FIELDS=[.1..2..6.]. The field numbers will be preselected at the field selection wizard page


Workspace Selection

When the Database Export Wizard is started without a (correct) workspace name command line parameter a wizard page will be shown with all workspaces found at your computer. You should select a workspace from the list. The current workspace will be highlighted.


File Selection

When the Database Export Wizard is started without a file number or file name command line parameter a wizard page to select a file from your filelist will be shown. You should select a file from the list. If you entered this page from the workspace selection wizard page and after selecting a file go back to the workspace selection page you need to reselect a file in this file selection wizard page.


Format Selection

Format

You can select one of the following 4 choices:

  1. With Comma Separated each database record is stored on one separate line, while the fields are separated by a field separator - which you specify via the field separator form on this same wizard page.

  2. With Line Delimited each database record is stored on multiple lines. Each field on a separate line in the output file. The number of lines in the output should be equal to the number of records multiplied by the number of fields.

  3. With Fixed Position - you may call this columnar output too - each field starts at a position which is equal to the previous field position plus its length plus one space.

  4. With XML, data will will be exported to an XML file following the XML rules.

Field separator

If you select the comma separated output, you may enter the separator character(s) to be used for the field separator.

The field separator is not limited to one character thus, if you want to specify multiple characters, you are free to do this. Use unique characters and do not use double quotes, because they will be used normally around literal texts.

The default according to your windows locale will be shown in this form.


Options for Export

This wizard page shows a list of check boxes for options you may want to select for your output. They are described below and you may check or uncheck them as desired. Some will only be available for appropriate types of export. This page will be shown only when the selection method is NOT XML.

Use selection criteria

This option differs a little from the other options on this page, as it enables or skips the selection criteria wizard page. If you forget to click this option you can always go back to this wizard page and select it afterwards. It will not influence other choices of this page.

Export Text Fields in HEX Format

Text fields usually contain of multiple lines of text, each line ending in a CR/LF. When you export this data you will find that these special characters corrupt the output. A CR/LF for example will break the line in two which makes all import routines almost worthless.

The DataFlex commands called WRITE_HEX and READ_HEX make it possible to output each character in a two-byte hexadecimal value. The capital "A" would be "41" when using this command. A CR/LF will be "0D0A."

Export Binary Fields in HEX Format

For Binary fields, DataFlex does not have a visual control available. This is usually a field for printer codes and other raw data. The size is limited to the record size and therefore not useable for bitmaps and other graphics - but the fieldtype should be able to cover it. When you export this data you often find that there are special characters present which can corrupt the output. A CR/LF for example will break the line in two which makes all import routines almost worthless.

The DataFlex commands called WRITE_HEX and READ_HEX make it possible to output each character in a two byte hexadecimal value. The capital "A" would be "41" when using this command. A formfeed will be "0C."

Export Field Names in First Row

This option will add the name of each field in the first row. When "comma delimited" output is selected the data will be between double quotes. When "fixed position" output is chosen the name will start at the beginning of the column.

Use Double Quotes around String Data

This option will put double quotes around string data, a choice often used when creating comma-separated data. For fixed-position output, this is often not desired. Be careful using this option when the data in a field contains double quotes, as you might have trouble reading in the data.

Print Leading Zeros

Some import routines require you to specify the leading zeros in numeric data. This option enables that. A value of 12,34 in a 4,2 field definition width will be output as 0012,34.

Trim String Output

This option will trim string fields, which is very useful when exporting in comma-delimited format and when you want to limit the size of the output file.

Pad Text Fields

Text fields are not padded with spaces in the database. When you want a fixed number of characters (some importing software requires this for length measurement) you can use this option. The text fields are printed with the rest of the length in spaces.


Options for XML Export

This page is available for XML output only

Use Selection Criteria

This option differs a little from the other options on this page, as it enables or skips the selection criteria wizard page. If you forget to click this option you can always go back to this wizard page and select it afterwards. It will not influence other choices of this page.

Preserve White Space

Selecting this checkbox sets the XML property pbPreserveWhiteSpace. The wizard will then try to not delete white space, but it cannot cause the preservation of white space exactly as it appeared in the original document. Instead, the object model replaces white space present in the original document with a single new line character in the representation returned. Similarly, this property contains a representation without the leading and trailing spaces, and replaces multiple intervening white space characters between words with a single space character.

Export Field Attributes

For each written record the field attributes of the field will be written. The attributes are DF_FIELD_NUMBER, DF_FIELD_TYPE, DF_FIELD_NATIVE_LENGTH, DF_FIELD_LENGTH, DF_FIELD_PRECISION.

Export File Attributes

It will cause the export of the file attributes as well as the data. This is done once per XML file in the first node. The following file attributes will be exported:

DF_FILE_DRIVER, DF_FILE_ROOT_NAME, DF_FILE_DISPLAY_NAME, DF_FILE_LOGICAL_NAME, DF_FILE_PHYSICAL_NAME, DF_FILE_OWNER, DF_FILE_RECORD_LENGTH, DF_FILE_RECORD_LENGTH_USED, DF_FILE_RECORDS_USED, DF_FILE_REVISION, DF_FILE_TRANSACTION, DF_FILE_COMPRESSION

For detailed information on the above referenced attributes see Database API Attributes in the Language Reference Help book.

Use CDATA Elements

Data from a database may contain formatting information which XML parsers may misunderstood. When this option is true (default) the data is not written as normal element data but with a !CDATA format. This makes it possible to have XML encoding data in the XML file within your data. Only "]]>" strings are not allowed inside this kind of element data.

Data Translation

This group makes it possible to tell the output routines if the source data needs to be converted from OEM (ASCII) to ANSI, from ANSI to OEM, or no conversion at all. XML expects the data to be UNICODE but accepts ANSI. ASCII is often misinterpreted. Since most DataFlex data is in OEM format, the conversion from OEM to ANSI is the most likely choice.


Selection Criteria

When the first checkbox at the options wizard page is checked you will see a wizard page in which you may specify a record selection formula.

Field Names List

This list shows the field names of the main file from which records are about to be read. The wizard limits the selection of fields to the fields of the main file. Once you click with the mouse on a different field in this list you will be prompted with the field selection criteria panel.

Formula Editor

This editor shows you the Database Export wizard record selection formula. The file and field names are not used, but the internal DataFlex representation (customer.name could be |FS22,3). This way, the whole selection can be handled by one function call to the EVAL() function.

When you try to enter the formula editor, you will see a question regarding modifying formulas. By default, the NO button is selected because modifying the formula should only be done by experts. Experienced users can skip the question by adding/changing the registry value for "ConfirmFormulaEditor". It should be a Dword value and when it is ZERO the question will be skipped, and you can enter the editor without a warning.

And Button

This button will insert the keyword "And" into the selection expression formula without you having to go to the editor and typing in the word yourself. It will always be placed at the end of the selection expression.

Or Button

This button will add/insert the keyword "OR" into the record selection formula. Entering or changing the formula yourself is also possible. It will always be placed at the end of the selection expression.

Check Button

A formula needs to be checked before you may continue to the next wizard page. The wizard will try via the DataFlex EVAL function to see if any errors appear. If the selection formula validate fails the next button will not become active. This is done to avoid errors during export.

Record Selection Criteria

This panel helps you in specifying the correct selection criteria. In this panel the field name is shown, while the record selection panel shows the internal representation of the field.

The panel shows the field name, its length and field type. Via an operator radio group you can pick the record selection operator, and in the select value field you can enter the value to select on. String fields belong between a pair of single or double quotes. With the OK button you will add the entered data to the formula editor, while the Cancel button will reverse the changes. The Browse data button will bring you a data sample panel.

Field Name

The field name is shown in a grayed-out form because you cannot and should not be able to edit the field name. It is shown for informative purposes.

Operator Radio Group

The operator to be used must be selected from this radio group. Any other variants which DataFlex offers are not supported by the Database Export Wizard.

Explanation:

Operator | Explanation
Eq | Field contents must be equal to the value specified
Ne | Field contents may not be equal to the value specified
Gt | Field contents must be greater then to the value specified
Lt | Field contents must be less then to the value specified
Ge | Field contents must be greater then or equal to the value specified
Le | Field contents must be less then or equal to the value specified
Contains | Field contents containing the specified value make the record selected.

Selection Value

In this form you should enter the selection value used for the currently pointer field. A selection value must match the field type and the DataFlex EVAL function rules.

Samples:

"Data Access Worldwide" | // With String EQ
123.45 | // With Numeric
"orld" | // With String CONTAINS
"12/31/2000" | // With Date

Field Type

The field type is shown in a grayed-out form and helps you in entering a correct value in the selection value form.

Field Length

This grayed out field shows the field length which helps you in entering a correct value in the selection value form.

Ok Button

This button will close the record selection panel and add the entered values to the end of the formula editor. When this is the second or higher expression you should first add an AND or an OR statement in the expression.

Cancel Button

This button will close the current record selection panel and choices are discarded. You can therefore always open this panel and, on a mistake, close it again. Nothing wrong will happen.

Browse Data Button

The browse data button will bring you to the sample data dialog. In this panel record samples are shown.

Sample Data Dialog

This panel can be used to see what data is in the file for the currently selected field. It is a sample of your data, which means that when the number of records becomes bigger, not all records are listed. The sample data is retrieved in a random order, sorted just before this panel appears.

The number of records listed can be managed by setting/adding the DWORD registry key value "MaxSampleDataRecCount". When the value of this registry entry is larger than the current number of records in the data file it will be set to the current maximum. When this registry value is not present, the number of sample records is 50.

By clicking the COPY button, the currently selected line will be put in the clipboard buffer, which makes it possible to use the exact value in the record selection value from the calling panel.


Field Selection

This wizard page shows you the fields from the opened file when the Database Export Wizard is started by Database Explorer. If you select a file at the file selection wizard page all fields will be preselected. The fields present in the Data TabPage grid will have a checkbox. By clicking the checkbox you indicate that the field should be included in the data export. The size of the field can be changed, but the name cannot be changed unless you have checked the "Export field names in first row" box in the export options wizard page (not available for XML). Adding additional fields or calculated fields etc is not possible.


Sort Order

The sort order wizard page lets you select an ordering to be used for export. The fasted method, when not using record selection criteria, is RECNUM (index 0). When using selection criteria, you can choose to force the output via a specific order or via the -1 CONSTRAINED_FIND technique.


Export to XML

If you previously selected XML, you will see the following two forms:

Create Report View

When selecting this checkbox you can enter a view-name in the form and when you then click finish in the final screen, a Visual DataFlex Report View file will be created. The view is registered for you, and you can immediately use it in the Studio.

Report View Name

If you have opted to create a Report View, you may change the object’s name from the default provided in this form.

Output to file

When selecting this checkbox you can enter a filename in the form and when you then click finish in the final screen, the data will be written to the specified file in XML format. The best way to use this form is by clicking the prompt button which will bring you a Windows Common File dialog.

Click Next to take you to the final screen.


Program/Output Names

If you previously selected Comma Separated, Line Delimited or Fixed Position, you will see the following three forms:

Create Visual DataFlex Program

When the checkbox is marked, a program name must be entered in the form. When the checkbox is not marked and there is a program name in the form, the program will not be created. The program created is a Single Document Interface (SDI) program which can not be maintained by the Studio. The program creates an export panel which gives the users the ability to express their options for exporting data. The generation routines check for the existence of cExportPanel.Pkg, ListSeparator.Pkg, MaxFilelistSlotCount.Pkg and cFilenameForm.Pkg in the path of the programname (or/usually appsrcpath of workspace) and if they are not there they will be generated too.

Output to file

When selecting this checkbox you can enter a filename in the form and when you then click finish in the final screen, the data will be written to the specified file in the previously-defined output method. The best way to use this form is by clicking the prompt button which will bring you a Windows Common File dialog.

Output to printer

When selecting this checkbox, you will be able to select or enter a printer device for output. When the value in the form is blank, no output to a printer device is made. The best way to use this form is by clicking the prompt button which will bring you a Windows Common Printer Selection dialog in which you can find the printers defined for your computer. The value in this form will not be used when the checkbox is not checked.


Finish

When you have made all the other selections, you get one final chance to go back and make changes, then simply click the Finish button and the output you selected will be written.


Database Export Wizard

When the Database Export Wizard starts, select the type of export you want. You may then cancel the export wizard or continue with making your choices. At all times you can go back to this opening screen. Canceling the wizard can also be done from all screens. Certain screens are dynamically created depending on your earlier selections and are changed appropriately if you change your earlier selections.