To be able to add an action export, which exports view data using a specific formatting format, an export format first has to already exist.
This can be accomplished by following the first chapter of this HowTo Guide:
An action which exports the view data using a specific formatting format can be added by using the script API_REDADM.ADD_APP_ACT_EXPORTS. This script will automatically fill in the action parameters necessary for an export, which would need to be added manually otherwise. Here, all of the variables are mandatory, except for the where clause. One has to choose a name for the export action, provide the name of the before created export formatting rule, select a schema name and table or view name of the object, which should be exported and choose a filename for the file that will be generated. The filename and the where clause can also contain placeholders such as @{bdate}, @{app_name} or @{run_id}.
EXECUTE SCRIPT API_REDADM.ADD_APP_ACT_EXPORTS(
'test_exp' -- p_exp_name
,'test_fmt' -- p_fmt_name
,'PSV_TEST_DR' -- p_obj_schema
,'TEST_TAB' -- p_obj_name
,'@{bdate}_@{app_name}_export.csv' -- p_filename
,'SYSDATE > @{bdate} - 5' -- p_where
);
After successfully running the code above, an action export is added to the table REDADM.RED_APP_ACT_EXPORTS.
exp_name | fmt_name | obj_schema | obj_name | filename | where_clause |
---|---|---|---|---|---|
test_exp | test_fmt | PSV_TEST_DR | TEST_TAB | @{bdate}_@{app_name}_export.csv | SYSDATE > @{bdate} - 5 |
To modify any of the parameters of an action export, one only has to provide the exact name of the action export as well as all new values for the parameters, which are supposed to be changed, and a 'null' for all parameters, which should keep their current value, to the script API_REDADM.MODIFY_APP_ACT_EXPORTS.
In the example below only the value for the where clause should be changed, while the rest remains the same.
EXECUTE SCRIPT API_REDADM.MODIFY_APP_ACT_EXPORTS(
'test_exp' -- p_exp_name
,null -- p_fmt_name
,null -- p_obj_schema
,null -- p_obj_name
,null -- p_filename
,'SYSDATE > @{bdate} - 3' -- p_where
);
After the command above is issued, the entry for the action export with the name 'test_exp' in the table REDADM.RED_APP_ACT_EXPORTS will be changed as can be seen in the table below.
exp_name | fmt_name | obj_schema | obj_name | filename | where_clause |
---|---|---|---|---|---|
test_exp | test_fmt | PSV_TEST_DR | TEST_TAB | @{bdate}_@{app_name}_export.csv | SYSDATE > @{bdate} - 3 |
An action export can be removed by providing its exact name to the script API_REDADM.REMOVE_APP_ACT_EXPORTS.
EXECUTE SCRIPT API_REDADM.REMOVE_APP_ACT_EXPORTS(
'test_exp' -- p_exp_name
);
After this script runs through, the entry about the action export with the name 'test_exp' will be removed from the table REDADM.RED_APP_ACT_EXPORTS.