All Products
Search
Document Center

Dataphin:Variable classification and assignment

Last Updated:Jun 23, 2026

Dataphin supports several variable types. Learn how variables are classified and how to assign date and time values to local variables.

Variable classification description

Dataphin categorizes variables as follows:

Variable Type

Description

Global Variable

Global variables are defined in Dataphin Planning- Common Business Logic-Global Variable and can be referenced in any node or code within the tenant. The built-in global variable is ${bizdate}.

Note
  • Global variables do not support sync tasks in current versions (supported in earlier versions only).

  • To configure global variables, see Create a global variable.

Space Name Variable

These include ${project name} and ${module name}, as illustrated in the calculation task example below.

image.png

  1. Retrieve the project or module name at ①.

  2. In the editor at ②, reference the project or module name using the ${project name or module name} syntax.

  3. The input parameter at ③ will be automatically identified by the system.

Note

Space name variables cannot be converted into other variable types.

Local Variable

Local variables do not need to be declared in advance. Use ${variable_name} in your code to define a local variable named variable_name. The following example shows this in a calculation task.

image.png

Variable names can contain only letters, digits, and underscores. Do not start a name with dp_glb_, which is reserved for global variables. The maximum length is 32 characters.

Important
  • If variable_name matches a global variable name, it is treated as a global variable reference. You can change its type to a local variable in the parameter settings.

  • If variable_name matches a project or module name, it is automatically treated as a space name variable.

  • To prevent ${variable_name} from being parsed as a variable in code, set it to non-variable in the parameter type settings.

  • To use ${variable_name} as a cross-node variable, select cross-node variable in the parameter type settings.

  • To set a local variable's parameter value to empty, click Parameter Value and then click Set To Empty.

Cross-node Variable

Cross-node variables are parameters passed from an ancestor node to the current node. Common scenarios include:

  • Ancestor node A passes a variable ${var} to descendant node B, which uses ${var} in its calculation logic. For example, exchange rates stored in a physical table can be read by a Python node and passed to downstream nodes for calculations.

  • Ancestor node A passes a variable ${var} to descendant node B, which uses ${var} to determine its running policy. For example, if a remote service status is "stopped," node B can perform a dry-run based on the status variable passed from A.

Important
  • Cross-node variables are not supported in real-time tasks.

  • When backfilling data for a node that uses cross-node parameters, you must backfill data for both the ancestor node that provides the parameters and the current node.

Variable assignment description

Date and time calculation expression

Dataphin supports the following date calculation operators for assigning date and time values to local variables:

  • Date and time calculations support the following formats:

    • For business date ${bizdate}, use the format: ${(yyyyMMdd|yyyy/MM/dd|yyyy-MM-dd) (+|-) n}.

    • For the expected running time (the node task's start time), use: $[(yyyyMMddHHmmss|yyyy/MM/dd HH:mm:ss|yyyy-MM-dd HH:mm:ss) (+|-) n].

  • Identifiers for date and time components:

    • Year: yyyy.

    • Month: mm for day-level granularity or MM for minute-level granularity (uppercase to differentiate from minute mm).

    • Day: dd.

    • Hour: HH.

    • Minute: mm.

    • Second: ss.

  • The base interval unit is one day:

    • Represent 1 hour as 1/24, 5 hours as 5/24.

    • Represent 1 minute as 1/1440 (1/24/60), 30 minutes as 30/1440.

Example reference

Current Date

Configuration Based on Business Date (T-1)

Actual Value

Configuration Based on Expected Running Time (T)

Actual Value

2018-01-10

${yyyymmdd}

20180109

$[yyyymmdd]

20180110

2018-01-10

${yyyyMMdd}

20180109

$[yyyyMMdd]

20180110

2018-01-10

${yyyymmdd -1}

20180108

$[yyyymmdd -1]

20180109

2018-01-10

${yyyymmdd -7}

20180102

$[yyyymmdd -7]

20180103

2018-01-10

${yyyy-mm-dd}

2018-01-09

$[yyyy-mm-dd]

2018-01-10

2018-01-10

${yyyy-mm}

2018-01

$[yyyy-mm]

2018-01

2018-01-10

${yyyy-mm -1}

2017-12

$[yyyy-mm -1]

2017-12

2018-01-10

${yyyy}

2018

$[yyyy]

2018

2018-01-10

${yyyy+1}

2019

$[yyyy + 1]

2019

2018-01-10

${yyyy/MM/dd HH:mm:ss}

2018/01/09 00:00:00

$[yyyy/MM/dd HH:mm:ss]

2018/01/10 00:00:00

2018-01-10

${yyyy/MM/dd HH:mm:ss-1/24}

2018/01/08 23:00:00

$[HH:mm:ss-5/24/60]

23:55:00