To add a format to which view and table data can be conversed into to be exported, one can use the script API_REDADM.ADD_APP_ACT_EXP_FMT. The only mandatory variables are the name the formatting rule should get and if CSV or Parquet should be used as format type. The rest of the variables are optional and can be used to set the date and timestamp format, to use encoding for the export session, to include the header as the first row or to set a replacement string for boolean or NULL values. Furthermore, a separator for columns or rows can be chosen, columns can be delimited and the BDATE column can be included as the first column. Additionally, one can also set how numbers should be depicted, for example if a thousand should either be represented as 1.000,00 or 1,000.00.
In the example below a csv export format is being created with various parameters set as well.
EXECUTE SCRIPT API_REDADM.ADD_APP_ACT_EXP_FMT(
'test_fmt' -- p_fmt_name
,'CSV' -- p_fmt_type
,'YYYYMMDD' -- p_date_format
,'YYYYMMDD HH24MISS' -- p_timestamp_format
,'UTF8' -- p_encoding
,true -- p_header
,null -- p_null_string
,'Y/N' -- p_boolean_string
,'auto' -- p_delimit
,';' -- p_column_separator
,'CRLF' -- p_row_separator
,false -- p_bdate_first_col
,',.' -- p_numeric_characters
);
After succesfully adding the formatting rule, it can be found in REDADM.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 | true | Y/N | auto | ; | CRLF | CSV | ,. |
To modify any of the export format parameters, the script API_REDADM.MODIFY_APP_ACT_EXP_FMT can be used. One has to provide the exact name of the export format which should be modified and then provide the new values for those parameters that should be changed and a 'null' for those which should stay the same. This is due to the scripts interpreting 'null' values in such a way, that current values will be kept, while any other value being provided, results in the current values being overwritten. In the example below a 'null' value is given for every parameter except for the name, which is necessary to identify the right export format and the header variable as this variable is sopposed to be changed.
EXECUTE SCRIPT API_REDADM.MODIFY_APP_ACT_EXP_FMT(
'test_fmt' -- p_fmt_name
,null -- p_date_format
,null -- p_timestamp_format
,null -- p_encoding
,false -- p_header
,null -- p_null_string
,null -- p_boolean_string
,null -- p_delimit
,null -- p_column_separator
,null -- p_row_separator
,null -- p_bdate_first_col
,null -- p_num_chars
);
After the script above has run successfully the entry in the table REDADM.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 | ,. |
To remove an export format one only has to provide the exact name of the format which should be removed to the script API_REDADM.REMOVE_APP_ACT_EXP_FMT.
EXECUTE SCRIPT API_REDADM.REMOVE_APP_ACT_EXP_FMT(
'test_fmt' -- p_fmt_name
);
The entry in the table REDADM.RED_APP_ACT_EXP_FORMATS will be removed.