5. Manage Action Export Formats¶
An export format defines how a table or view is written to a file by an export action (export_mail, export_sftp, export_file).
5.1. Create an Export Format¶
Create a CSV or Parquet format with API_REDADM.ADD_APP_ACT_EXP_FMT. Besides the name, all parameters are optional; NULL uses the default value:
PARAMETER |
DEFAULT |
DESCRIPTION |
|---|---|---|
p_fmt_type |
CSV |
CSV or PARQUET |
p_date_format |
yyyymmdd |
date format of the export session |
p_timestamp_format |
yyyymmddhh24miss |
timestamp format of the export session |
p_encoding |
utf8 |
character encoding |
p_header |
false |
include the column names as first row |
p_null_string |
replacement string for NULL values |
|
p_boolean_string |
true/false |
replacement strings for boolean values |
p_delimit |
always |
delimit the columns: always, auto, never |
p_column_separator |
; |
CSV only: column separator |
p_row_separator |
LF |
CSV only: row separator (LF, CRLF) |
p_bdate_first_col |
false |
include the BDate as first column |
p_numeric_characters |
., |
decimal and thousands separator |
The following example creates a CSV format with the date format YYYYMMDD, the timestamp format YYYYMMDD HH24MISS, UTF-8 encoding, Y/N for boolean values, semicolon as column separator, German number notation (‘,’ as decimal separator), and no header.
Example: Create the CSV Format ‘test_fmt’
1EXECUTE SCRIPT API_REDADM.ADD_APP_ACT_EXP_FMT(
2 'test_fmt' -- p_fmt_name
3 ,'CSV' -- p_fmt_type
4 ,'YYYYMMDD' -- p_date_format
5 ,'YYYYMMDD HH24MISS' -- p_timestamp_format
6 ,'UTF8' -- p_encoding
7 ,false -- p_header
8 ,null -- p_null_string
9 ,'Y/N' -- p_boolean_string
10 ,'auto' -- p_delimit
11 ,';' -- p_column_separator
12 ,null -- p_row_separator
13 ,false -- p_bdate_first_col
14 ,',.' -- p_numeric_characters
15);
The format is stored in REDADM.RED_APP_ACT_EXP_FORMATS:
FMT_NAME |
FMT_TYPE |
DATE_FORMAT |
TIMESTAMP_FORMAT |
ENCODING |
HEADER |
BOOLEAN_STRING |
DELIMIT |
COLUMN_SEPARATOR |
ROW_SEPARATOR |
NUMERIC_CHARACTERS |
|---|---|---|---|---|---|---|---|---|---|---|
test_fmt |
CSV |
YYYYMMDD |
YYYYMMDD HH24MISS |
UTF8 |
false |
Y/N |
auto |
; |
LF |
,. |
5.2. Modify an Export Format¶
To modify an export format, use API_REDADM.MODIFY_APP_ACT_EXP_FMT. NULL leaves a parameter unchanged, while a blank (’ ‘) restores its default value.
Example: Change the Row Separator to CRLF
1EXECUTE SCRIPT API_REDADM.MODIFY_APP_ACT_EXP_FMT(
2 'test_fmt' -- p_fmt_name
3 ,null -- p_fmt_type
4 ,null -- p_date_format
5 ,null -- p_timestamp_format
6 ,null -- p_encoding
7 ,null -- p_header
8 ,null -- p_null_string
9 ,null -- p_boolean_string
10 ,null -- p_delimit
11 ,null -- p_column_separator
12 ,'CRLF' -- p_row_separator
13 ,null -- p_bdate_first_col
14 ,null -- p_numeric_characters
15);
The entry in REDADM.RED_APP_ACT_EXP_FORMATS has changed:
FMT_NAME |
FMT_TYPE |
DATE_FORMAT |
TIMESTAMP_FORMAT |
ENCODING |
HEADER |
BOOLEAN_STRING |
DELIMIT |
COLUMN_SEPARATOR |
ROW_SEPARATOR |
NUMERIC_CHARACTERS |
|---|---|---|---|---|---|---|---|---|---|---|
test_fmt |
CSV |
YYYYMMDD |
YYYYMMDD HH24MISS |
UTF8 |
false |
Y/N |
auto |
; |
CRLF |
,. |
5.3. Remove an Export Format¶
To remove an export format, use API_REDADM.REMOVE_APP_ACT_EXP_FMT.
Example: Remove the Format ‘test_fmt’
1EXECUTE SCRIPT API_REDADM.REMOVE_APP_ACT_EXP_FMT(
2 'test_fmt' -- p_fmt_name
3);
The entry is removed from REDADM.RED_APP_ACT_EXP_FORMATS.