edifact/eancom DTM type check(format a, check type b, [force false c])

Prev Next

Returns true if the DTM format code a (data element 2379) represents a value of the type specified by b; otherwise, false. The format code comes from a EDIFACT or EANCOM DTM segment.

Example: In DTM+137:20240302:102', the format code is 102.

This function allows you to determine how the value of a DTM segment should be processed before edifact/eancom DTM to timestamp parsing or edifact/eancom DTM to number parsing is called, for example, in a mapping condition. Only the format code is checked; the value of the DTM segment is neither required nor used for this purpose.

Leading and trailing spaces in format code a and validation type b are removed; case is not significant.

Parameter

Parameter

Description

a

DTM format code (data element 2379), e.g., 102, 203, 718. See the "Format codes" section below. An unknown format code results in an error and the process is terminated.

b

(optional) Type to be checked.

  • date(time) – The format code represents a date and/or a time, so it can be processed using edifact/eancom DTM to timestamp parsing.

  • only_date – The format code represents a date without a time.

  • only_time – The format code represents a time without a date.

  • number – The format code represents a number or contains a number, so it can be processed using edifact/eancom DTM to number parsing.

  • has_range – This format code represents a time period consisting of a start and an end.

Default: date(time)

c

(optional) Forces an empty value. If true, the function immediately returns an empty value with the empty flag set, without checking the format code a – for example, if the source field is empty. Default: false

Format codes

The following table lists the supported format codes and the validation types for which the function returns true. For all other combinations, the result is false.

Codes

Meaning

date(time)

only_date

only_time

number

has_range

2, 3, 4, 101, 102, 103, 105, 106, 600, 601, 602, 603, 604, 608, 609, 610, 613, 614, 615, 616

Calendar date

true

true

false

false

false

6, 7, 8, 9

Calendar date, followed by a number (half of the month, week of the month, shift, time period)

true

true

false

true

false

5, 10, 201, 202, 203, 204, 205, 206, 207, 208, 301, 302, 303, 304, 305, 306, 307

Date and time

true

false

false

false

false

209, 401, 402, 404, 405, 406

Time

true

false

true

false

false

104, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 715, 716, 717, 718

Time period consisting of two calendar dates

true

true

false

false

true

308, 713, 719, 720, 721, 20E, 21E, 22E

Time period consisting of two date-time entries

true

false

false

false

true

210, 501, 502, 503

Time period consisting of two times

true

false

true

false

true

107, 108, 109, 110, 801–814

Number (day, week, or month number; number of years, months, weeks, days, hours, minutes, seconds, half-years, four-month periods, quarters, half-months, ten-day periods, days of the week, working days)

false

false

false

true

false

EANCOM also defines the codes 20E, 21E, and 22E (listed in the table under “Date-Time Periods”), which are not included in the UN code list. The definitions of the remaining format codes can be found in the code list for UN/CEFACT data element 2379: UN/CEFACT UNCL 2379.

Examples

The c parameter is empty unless otherwise specified.

Parameter a

Parameter b

Parameter c

Result

6

only_date

true

6

number

true

102

true

102

date(time)

true

102

only_date

true

102

only_time

false

102

number

false

102

has_range

false

102

ONLY_DATE

true, this validation type is not case-sensitive

102

only_date

true

Empty value with the empty flag set; a is not checked

203

date(time)

true

203

only_date

false

308

date(time)

true

308

has_range

true

501

only_time

true

501

has_range

true

501

only_date

false

801

date(time)

false

801

number

true

Error handling

Parameter a

Parameter b

Result

999

date(time)

Terminated with error unsupported format code: "999".

102

weekday

Terminated with error invalid check type "weekday".