Date Math Transformation

The DateMathTransformation allows us to pick a value from a variable and add/subtract something to it.

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.

  1. 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).

  2. The transformationGroups array contains transformations to be applied on specified inputs. In this case, it extracts the createDate from xmpMetadata and applies DateMathTransformation on it.

  3. The DateMathTransformation object requires a timeSpan 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 }