Configure variables

Updated at:

The task orchestration feature of Data Management DMS provides a variety of time variable formats. You can reference these variables in tasks and task flows to improve development efficiency and simplify SQL statements.

Procedure

  1. Log in to DMS 5.0.

  2. In the top navigation bar, choose Data+AI > Data Development > Task Orchestration(Old).

  3. On the Task Orchestration page, in the Free orchestration tasks section, click New Task Flow.

  4. In the New Task Flow dialog box, enter a Task Flow Name and Description, and then click OK.

  5. On the task flow canvas, click a blank area.
  6. In the left-side navigation pane, click the Task flow variable tab.
    Note You can also configure variables for a single task. The differences are as follows:
    • Task flow variable: can be referenced by any task in the current task flow.
    • Single-task variable: can be used only within the current task.
  7. Configure the Variable Name and Variable Rule parameters.
    Parameter Description
    Variable Name The name of the custom variable.
    The system provides one built-in variable: bizdate. This variable uses the yyyy-MM-dd format and is set to the day before the task runs. For example, if a task runs on August 15, 2019, the value of bizdate is 2019-08-14.
    Note To delete a configured variable, click the 3.12变量删除图标 icon.
    Variable Rule Specify a time format for the variable. All custom variables are calculated based on the timestamp of the bizdate variable. For more information, see Time formats.
    You can also specify an offset. Use + for a future offset and - for a past offset. For example, -6M represents a point in time six months in the past.
    Note After configuring a variable, you can reference it in your SQL statements by using the ${Variable Name} format. You can click SQLPreview to verify the configuration.
  8. Click Save to apply the settings.

Time formats

The following time formats are supported:

Time component Description Sample input Sample output
Era The era designator, such as Anno Domini (AD). Gyyyy AD 2021
Year
  • y: The year. y is equivalent to yyyy. yy represents the last two digits of the year.
  • Y: The week-based year. It refers to the year of a given week, where the week is considered to end on Sunday.
yyyy 2021
Month M: The month of the year. M formats the month as 1-12; MM formats it as 01-12. MMM returns the month name, such as January to December. MM 08
Week
  • w: The week of the year. w formats the week as 1-53; ww formats it as 01-53.
  • W: The week of the month (1-5).
ww 13
Day
  • D: The day of the year. D returns values from 1 to 366. DD returns values from 01 to 366. DDD returns values from 001 to 366.
  • d: The day of the month. d returns values from 1 to 31. dd returns values from 01 to 31.
D 360
Day of week
  • E: The name of the day of the week, such as Monday.
  • e: The number of the day of the week. By default, this is a value from 1 to 7, where 1 is Monday and 7 is Sunday.
    Note You can configure an offset of +1 day to align with calendars where Sunday is the first day of the week.
e 1
AM/PM a: The AM/PM marker. Returns AM for the time range 00:00–11:59 and PM for the time range 12:00–23:59. a AM
Hour
  • H: The hour of the day (0-23). H returns values from 0 to 23. HH returns values from 00 to 23.
  • h: The hour in AM/PM (1-12). h returns values from 1 to 12. hh returns values from 01 to 12.
  • K: The hour in AM/PM (0-11). K returns values from 0 to 11. KK returns values from 00 to 11.
  • k: The hour of the day (1-24). k returns values from 1 to 24. kk returns values from 01 to 24.
HH 10
Minute m: The minute of the hour. m formats the minute as 0-59; mm formats it as 00-59. m 27
Second
  • s: The second of the minute.
  • S: The millisecond.
ss 08
Time zone The time zone. z UTC+08:00
Combination examples:
Sample input Sample output
yyyy-MM-dd 2019-08-02
HH:mm:ss 11:05:21
yyyyMMdd HH:mm:ss 20190802 11:05:21
yyyyMM01 20190801