Table of Contents
Date Math Transformation
Table of Contents
The DateMathTransformation allows us to pick a value from a variable and add/subtract something to it.
The Date Math Transformation feature in our Business Rule Configuration represents a powerful tool that automates data manipulation and optimization. It's an incredibly versatile feature that enables you to add or subtract a specific interval from a date field in your data sources, for example adding 10 years to the creation date of a content item.
Common use cases include:
- Forecasting and Planning: Businesses can leverage this feature to perform long-term forecasting and strategic planning. For instance, a company with long-term contracts or assets that last several years could use this feature to automatically generate expected expiration or renewal dates.
- Automated Content Management: Media companies or those with extensive digital asset libraries can use this feature for automated content management. Adding a fixed number of years to the creation date could help in defining content lifecycle and planning for updates or archiving.
- Regulatory Compliance: Many industries are regulated with strict guidelines regarding data retention periods. Adding a certain number of years to a document's creation date can assist in automatically managing these data retention requirements, helping companies maintain compliance with less manual effort.
The DateMathTransformation is a transformation in the Business Rule configuration which allows for automated manipulation of date data types. It specifically enables you to add or subtract a specified interval from a date.
Benefits of this transformation
- Efficiency: Saving valuable time, eleminating the need for manual date manipulations and minimize human errors.
- Consistency: Ensuring consistent date manipulation to maintain data integrity and consistency, vital for data analysis and reporting, as well as decision making.
- Scalability: Scaling data manipulations, ensuring that increased data volume won’t affect the business ability to perform calculations.
Specific Definitions
Property | Value |
kind | DateMathTransformation |
timeSpan | In the format "days.hours:minutes:seconds", here "365” |
Date Manipulation based on XMP CreationDate
This code allows you to take the date from the createDate
field in xmpMetadata
and add 10 years to it.
- The
condition
key allows you to specify conditions. In this example, the Content Schema condition is null, which means the Business Rule executes for all Content Types (images, videos etc. ) without further refinement (ContentSchemaCondition
with null schemaId). - The
transformationGroups
array contains transformations to be applied on specified inputs. In this case, it extracts thecreateDate
fromxmpMetadata
and appliesDateMathTransformation
on it. - The
DateMathTransformation
object requires atimeSpan
to be specified in the format "days.hours:minutes:seconds". Here, "365
You can also use the variable $$utcNow$$ as input.
{
"kind": "BusinessRuleConfigurable",
"condition": {
"kind": "ContentSchemaCondition",
"schemaId": null,
"traceRefId": null,
"names": {},
"description": {}
},
"transformationGroups": [
{
"inputs": [
"$$metadata$$"
],
"transformations": [
{
"kind": "TakeDictionaryValueTransformation",
"key": "xmpMetadata",
"traceRefId": null,
"names": {},
"description": {}
},
{
"kind": "TakeDictionaryValueTransformation",
"key": "xmp",
"traceRefId": null,
"names": {},
"description": {}
},
{
"kind": "TakeDictionaryValueTransformation",
"key": "createDate",
"traceRefId": null,
"names": {},
"description": {}
},
{
"kind": "DateMathTransformation",
"timeSpan": "3650.00:00:00",
"traceRefId": null,
"names": {},
"description": {}
}
],
"storeIn": "creationDatePlus10years",
"traceRefId": null,
"names": {},
"description": {}
}
],
"actions": [
{
"kind": "AssignLayerAction",
"layerId": "RegulatoryCompliance",
"defaultValues": {
"dateField": "$creationDatePlus10years$"
},
"traceRefId": null,
"names": {},
"description": {}
}
],
"id": "add10YearsToXmpCreationDate",
"triggerPoints": [
{
"executionScope": "MainDoc",
"documentType": "Content",
"action": "Create"
}
],
"isEnabled": true,
"names": {
"en": "Add 10 years to xmp creation date",
"x-default": "Add 10 years to xmp creation date"
},
"description": {},
"enableTracing": false
}