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
Log in to DMS 5.0.
-
In the top navigation bar, choose .
On the Task Orchestration page, in the Free orchestration tasks section, click New Task Flow.
In the New Task Flow dialog box, enter a Task Flow Name and Description, and then click OK.
- On the task flow canvas, click a blank area.
- 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.
- 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 theyyyy-MM-ddformat and is set to the day before the task runs. For example, if a task runs on August 15, 2019, the value ofbizdateis 2019-08-14.Note To delete a configured variable, click the
icon.Variable Rule Specify a time format for the variable. All custom variables are calculated based on the timestamp of the bizdatevariable. For more information, see Time formats.You can also specify an offset. Use+for a future offset and-for a past offset. For example,-6Mrepresents 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. - 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 |
|
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 |
|
ww | 13 |
| Day |
|
D | 360 |
| Day of 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 |
|
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 |
|
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 |
Is this page helpful?