Skip to main content

DocuMine Documentation

Transformation and standardization of a date

Dates in several formats, e.g., dd.mm.yyyy or mm/dd/yy, can be transformed and standardized to dd/mm/yyyy format using the 'convertDates' method.

rule "ReportDate.0.0: All report dates converted to dd/MM/yyyy"
    when
        $startDates: List() from collect (Entity(type == "experimental_start_date"))
    then
        componentCreationService
        .convertDates(
            "ReportDate.0.0",
            "Experimental_Starting_Date",
            $startDates
        );
    end

Syntax

Explanation

rule “ReportDate.0.0”

Name of the rule

Each rule must have a unique name. For further information, please see Rule naming.

$startDates: List() from collect (Entity(type == "experimental_start_date"))

Targets and list all information in the entity with the type “experimental_start_date”.

componentCreationService

Calls the service responsible for creating components.

.convertDates("ReportDate.0.0", "Experimental_Starting_Date", $startDates);

Invokes the ‘convertDates’ method to create a component named “Experimental Starting Date” that converts all date formats to the format dd/mm/yyyy. That component includes the listed information from the entity with the type “experimental_start_date” and applies the "ReportDate.0.0" identifier.

Notice

For further information about the methods listed in the table, please refer to the relevant sections in the Javadoc documentation:

https://docs.documine.ai/javadoc/index.html

Following the rule execution, you will be able to observe the following outcomes in the component list:

Transformation_result_1_2.png

Result in the component list