Introduction
The convertduration is a custom transformation that converts columns containing duration in various formats to ISO 8601 duration format. Use convertduration with the data type duration if you do not have your duration data in seconds as integers or durations in the ISO8601 format.
Procedure
Preparing convertduration script
To prepare convertduration transformation script, follow these steps:
- Click the Enrich element.
- In the top left corner, click Select Workspace.
- From the list, select the Workspace you have chosen to work with in Connect, Enrich & Transfer.
- Click +Add in the upper right corner.
- (Optional) Write a name and a description.
- Click + Add Instruction.
- Select convertduration.
- Next to Fields, click + plus icon.
- Write the exact name of a field that contains a duration you want to convert.
- In the Input duration format field, select the original (input) duration format that you want to convert to ISO 8601 duration format.
- Click Save.
Using convertduration script
To use convertduration transformation script, follow these steps:
- Click the Connect element.
- In the top left corner, click
Select Workspace.
- From the list, select the Workspace you have chosen to work with in Connect, Enrich & Transfer.
- In the left navigation panel, click Datastreams.
- Click a Datastream.
- In Transformations, click Edit scripts.
- Write the name of the script that includes the convertduration transformation.
- Click Fetch.
Code
[
[
"convertduration",
{
"subtable": null,
"fields": [
"NewFieldName"
],
"format": "HH:MM:SS",
"_comment": null
}
]
]
param str subtable: Name of a subtable in which the output is stored.
param array fields: Specify the name of the field to be converted to ISO 8601 format.
param str format: Specify input format of original duration to be converted to ISO 8601 format.
param str comment: A comment that appears in the Transformation UI.
Comments
0 comments
Please sign in to leave a comment.