Custom Export

Introduction

The custom export functionality is intended for creating an export template file with a set of dynamic and static properties. Once created, the export template is delivered to a customer who can execute it on the real data.

Functionality

This section will show you how to import an export template and execute it. 

Execute Export Template

Once created, the export template may be distributed between customers. A customer can import the template and use it with his/her data. To import a template, proceed as described below:

  1. Click the Template button under the Template pane. This opens the menu, where you can select the Import option: 


  2. When the Open system dialog appears, select the directory where the export template file is located and click Open:


As a result, the export template opens in the General Code Editor (Export) dialog:


On processing the template on the customer's real data and maybe adding the necessary modifications (see Define Dynamic Parameters), a customer can save the export file by clicking the OK button at the bottom of the General Code Editor (Export) dialog. A new custom export code then appears in the grid:

You can easily access the processed export template file. For this, navigate to the Tools ribbon tab > Export > Custom export > export file name:


On executing the export, the export engine generates the export dialog form where you must enter export parameters:

In the dialog, all the fields are mandatory.



Scheduling and executing a template in the background

Using the Custom Export Replicator plugin it is possible to execute one or more templates in the background. 

For more information see the document Custom Export Scheduler



Housekeeping

The section provides step-by-step instructions on how to get everything set up.



Define Custom Export Code

To define a new export code, follow the steps below:

  1. Go to the Setup ribbon tab and click the General Codes button.

  2. On the Structure pane, click the Custom Export code category to expand it and select Export.

  3. Click the New button in the Actions group of the Manage ribbon tab. The General Code Editor (Export) dialog then appears:

  4. Within the dialog, create an export file by filling in the fields below:

    • Enter a Code (mandatory field), a unique alpha-numeric APM code.

    • In the Text field, indicate the name of an export file and its alternative name, if needed, in the Alternative field.

    • In the Sort field, define the order number of a record (where 0 means the first record in the list).

    • In the Template sector, create groups and sections. For more information, see Create Groups, Sections, Fields.

    • In the Parameters sector, define the export file parameters. For more information, see Define Parameters.

    • In the Export Format sector, select the format of the file to be exported. For more information, see Set File Format.


On completing, click OK to save the records.



Create Groups, Sections, Fields

To create a template file, you have to add groups, sections, and template fields on the Template pane of the General Code Editor (Export) dialog. When opening the dialog, by default, the system shows the Export Template root node of the template hierarchical structure. By adding groups, sections, and/or fields, you will then build the structure of the template file.


To add a group or a section as a child node, use one of the ways below:

  • Click the Insert button located right under the Template pane and select one of the options: Group, Section

-or

  • On the Template pane, right-click the Export Template root node. When the context menu appears, point to Insert and select either Group or Section:





When done, opens the SQL Statement dialog where you can enter a SQL statement to retrieve data from the database:

You can optionally add a comment to the Tag field. The comment will then appear in the XML output file.


On completing, click OK to proceed.



Besides, you can add template fields on the Template pane. To do this, follow the steps below:

  1. Right-click the added section. The context menu appears:


  2. In the context menu, select Insert > Field > field type.



The export engine supports four template fields: Integer, String, Float, DateTime. Each field has a specific list of settings and a list of common properties:




Let us review the template field properties in detail:

Property

Description

Date-Time Format

The property is available for the DateTime type. Set the format in which you want to display the date and time. For example: yyyy/mm/dd, dd.mm.you.

Sign Position

The property is available for the Integer and Float field types. Specify the position of a sign (plus or minus) by selecting one of the options:

  • spBeforeNumber sets a sign (plus or minus) before a numeric value

  • spAfterNumber sets a sign (plus or minus) after a numeric value

Visible Sign

The property is available for the Integer and Float field types. Specify whether the defined sign (plus or minus) is to be available in the output file. For this, select one of the options:

  • vsNegative makes a sign (plus or minus) unavailable

  • vsPositive makes a sign (plus or minus) available

Fractional Decimal

Count

The property is available for the Float field type. Enter the number of digits you want to be displayed to the right of the decimal point. 

Show Fractional Part

The property is available for the Float field type. Choose whether you want to display the decimal part of a numeric value by selecting one of the options:

  • True displays the decimal part

  • False hides the decimal part

Decimal Separator

The property is available for the Float field type. Enter a decimal separator that is used to separate the integer part from the decimal part.

Type

The property is available for all the fields. Define the type of the data source in a field by selecting one of the options: ftDataField, ftParamField. If ftParamField is set for the field, then a user of an export file will be able to enter a value in the dialog form, and this value will be as a data source. The engine automatically creates the corresponding input parameters in the Parameters sector (see Define Parameters). Otherwise, in case the Type property is set to ftDataField, the data source will be fetched from the SQL statement in the parent section.

Field Name

The property is available for all the fields. Enter the name of a new parameter. The value is fetched to the Parameters sector in case FieldType equals ftParamField. For more information, see Define Parameters.



The property is available for all the fields. Specify the value to be used by default in case the value itself is empty in the data source. The value is fetched to the Parameters sector in case FieldType equals ftParamField. For more information, see Define Parameters.

Caption

The property is available for all the fields. Specify the title of the column in the output template file. The value will be fetched to the Parameters sector. This property can be used with the MS Excel and Comma Separated Values output file formats. For more information, see Set File Format.

Length

The property is available for all the fields. Enter a numeric value that defines the actual length of the column. If the property is set to 0, the export engine does not restrict the column length.

Max Length

The property is available for all the fields. Enter a numeric value that defines the maximum length of the field.

Filler

The property is available for all the fields. Enter the symbol to be used to fill empty spaces at the end of the output string. If not specified, spaces are used as default

Align

The property is available for all the fields. Set the value alignment in a column by selecting one of the options:

  • vaLeft displays values in left-to-right format

  • right display values in right-to-left format

 



Define Parameters

Based on the defined field type, either ftParamField or ftDataField, you can pass dynamic or static values to the output files (see Create Groups, Sections, Fields). If a parameter is a template field where FieldType equals ftDataField, then the system fetches the parameters and their properties directly from the SQL statement.

Otherwise, in case FieldType is set to ftParamField, define the properties of the parameter by clicking the Export Template root node in the Template sector:


Caption. Set the parameter caption to make it available in the dialog form.
Type. Set one of the following parameter types:

  • The text allows entering any values into a field. On setting the parameter type, the Mask column becomes active. In the column, you can limit the value types to be entered.

  • Date allows entering dates into the field.

  • The number allows entering only numeric values.

  • DropDown gives the possibility to set the predefined list of values. On setting the DropDown type, click the 

    button in the Mask column. This opens the List editor dialog where you can add the values one by one by clicking the Add Item button:


    Click OK to save the records and exit the dialog.

  • Lookup enables you to define the list of values based on the General Code values. On setting the Lookup type, click the button in the Mask column. This opens the List editor dialog where you can select the general code to be displayed in the output file:

    Click OK to save the records and exit the dialog.



Define Dynamic Parameters

The export engine has three types of parameters used in the SQL statement in the section and/or group. They are:

  • inline. The parameter is used for adding some values into the SQL statement when preparing an export file.

  • dataset. The parameter is used for adding some values into the SQL statement when preparing an export file.

  • inherit. The inherit parameter picks up data from the parent section only.

By using the dataset and inline parameters, a customer can enter an additional SQL parameter without modifying the export template.

To define a parameter, first, make sure to surround it in the angle brackets <> and follow the rules below based on the parameter type in use:

  • for an inline parameter, use the '@' prefix followed by a parameter name

  • for a dataset parameter, use the ':' prefix followed by a parameter name

  • for an inherent parameter, no prefix is required



Let us see the example of defining an inline dynamic parameter:


  1. Add an inline parameter into the SQL statement considering the syntax:

  2. Create a new field with the respective name:



  3. On the Template pane, click the Export Template root node. In the Parameters sector, you can see the added parameter:


    Fill in the fields: Caption, Type, and/or Mask. For more information on parameter properties, see Define Parameters.




Set File Format

In the General Code Editor (Export) dialog, you can define the format of the export file as well as export file properties:

For this, in the Export format sector, proceed as described below:

  1. In the Format drop-down list, select the preferred format of the export file: 

    • ASCI Fixed Length

    • Comma-Separated Values

    • MS Excel

  2. Selecting the file format displays the corresponding properties. Edit the property values based on your preferences.



Let us consider the properties in detail:

ASCI Fixed Length Properties

Description

ASCI Fixed Length Properties

Description

Output extension

Define the extension of an export output file (.txt, .ads, etc).

Use UTF8 charset

Specify the encoding to be used. For this, select one of the options:

  • True sets the encoding to UTF8 charset

  • False set the encoding that is used on your operating system.

 



Properties of
Comma-Separated Values

Description

Properties of
Comma-Separated Values

Description

Header

Select whether you want to display column headers by selecting one of the options:

  • True allows displaying column headers (fetched from the Caption field property) in the output file

  • False cancels displaying column headers in the output file 

Quote Mark

According to the CSV standard, text values with spaces between must be surrounded by a quotation mark.

Delimiter

Enter a delimiter to be used to separate values.

Record delimiter

Enter a delimiter to be used at the end of each row in the output export file.

Output extension

Define the extension of an export output file (.txt, .ads, etc).

Use UTF8 charset

Specify the encoding to be used. For this, select one of the options:

  • True sets the encoding to UTF8 charset

  • False set the encoding that is used on your operating system.



MS Excel Properties



MS Excel Properties



Header

Select whether you want to display column headers by selecting one of the options:

  • True allows displaying column headers (fetched from the Caption field property) in the output file

  • False cancels displaying column headers in the output file 

Output extension

Define the extension of an export output file (.txt, .ads, etc).

Use UTF8 charset

Specify the encoding to be used. For this, select one of the options:

  • True sets the encoding to UTF8 charset

  • False set the encoding that is used on your operating system.







Save Export Template

On creating the export template, you can now export it to your local machine. To do this, follow the steps below:
 

  1. Click the Template button under the Template pane. This opens the menu, where you can select the Export option: 

  2. When the Save As system dialog appears, specify the save location, enter a file name and click Save: