4. Manage Action Export Formats¶
4.1. Create an Export Format¶
Create a CSV/Parquet-format for a table or view to be exported by using API_REDADM.ADD_APP_ACT_EXP_FMT. Besides the name and the format type all other parameters are optional.
The example below creates a CSV export format with the following properties:
output type: CSV
date format: YYYYMMDD
timestamp format: YYYYMMDD HH24MISS
encoding: UTF-8
boolean values should be translated to Y/N
column delimiter: semicolon
use German notation for numeric formats
no header
use LF as default row separator
Example
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);
After succesfully adding the formatting rule it can be found in RED_APP_ACT_EXP_FORMATS.
FMT_NAME |
DATE_FORMAT |
TIMESTAMP_FORMAT |
ENCODING |
HEADER |
BOOLEAN_STRING |
DELIMIT |
COLUMN_SEPARATOR |
ROW_SEPARATOR |
FMT_TYPE |
NUMERIC_CHARACTERS |
---|---|---|---|---|---|---|---|---|---|---|
test_fmt |
YYYYMMDD |
YYYYMMDD HH24MISS |
UTF8 |
false |
Y/N |
auto |
; |
(null) |
CSV |
,. |
4.2. Modify an Export Format¶
To modify any of the export format parameters use the script API_REDADM.MODIFY_APP_ACT_EXP_FMT. Providing NULL leaves the parameters as is, while a blank (’ ‘) restores the default value.
Example: change row separator to CR+LF
1EXECUTE SCRIPT API_REDADM.MODIFY_APP_ACT_EXP_FMT(
2 'test_fmt' -- p_fmt_name
3 ,null -- p_date_format
4 ,null -- p_timestamp_format
5 ,null -- p_encoding
6 ,null -- p_header
7 ,null -- p_null_string
8 ,null -- p_boolean_string
9 ,null -- p_delimit
10 ,null -- p_column_separator
11 ,'CRLF' -- p_row_separator
12 ,null -- p_bdate_first_col
13 ,null -- p_num_chars
14);
After the script above has run successfully the entry in the table RED_APP_ACT_EXP_FORMATS will be changed as follows:
FMT_NAME |
DATE_FORMAT |
TIMESTAMP_FORMAT |
ENCODING |
HEADER |
BOOLEAN_STRING |
DELIMIT |
COLUMN_SEPARATOR |
ROW_SEPARATOR |
FMT_TYPE |
NUMERIC_CHARACTERS |
---|---|---|---|---|---|---|---|---|---|---|
test_fmt |
YYYYMMDD |
YYYYMMDD HH24MISS |
UTF8 |
false |
Y/N |
auto |
; |
CRLF |
CSV |
,. |
4.3. Remove an Export Format¶
To remove an export format use API_REDADM.REMOVE_APP_ACT_EXP_FMT.
Example
1EXECUTE SCRIPT API_REDADM.REMOVE_APP_ACT_EXP_FMT(
2 'test_fmt' -- p_fmt_name
3);
The entry in the table RED_APP_ACT_EXP_FORMATS will be removed.