All Products
Search
Document Center

Dataphin:Variable groups and global variables

Last Updated:Jul 07, 2025

Dataphin enables the creation of global variables, streamlining task code by eliminating redundant definitions and reducing maintenance efforts. These global variables include permission controls and code review features, enhancing security. This topic describes how to create a variable group and a global variable.

Create a variable group

Variable groups organize variables for simplified management and retrieval.

  1. On the top menu bar of the Dataphin homepage, select Planning > Common Business Logic.

  2. On the Common Business Logic page, click the Global Variable tab.

  3. Under the Global Variable tab, click Create Variable Group to open the Create Variable Group dialog box.

  4. In the Create Variable Group dialog box, enter the Variable Group Name and Variable Group Code as detailed in the table below.

    Parameter

    Description

    Variable Group Name

    Customize the variable group name. The name must meet the following requirements:

    • Must be globally unique.

    • Cannot exceed 64 characters in length.

    Variable Group Code

    Customize the variable group code, which is used to verify the uniqueness of the variable group. The code must meet the following requirements:

    • Must be globally unique.

    • Can only contain numbers, letters, and underscores.

    • Cannot exceed 64 characters in length.

  5. Click OK to complete the creation of the variable group.

Create a global variable

  1. Under the Global Variable tab, click Create Global Variable.

  2. In the Create Global Variable dialog box, configure the global variable parameters.

    The system supports three variable types: Common Variable, Date And Time, and Account Password. Each type has different configuration requirements. The parameters for each variable type are described as follows:

    Common variable and account password

    Parameter

    Description

    Basic Information

    Variable Name

    Customize the variable name. Cannot exceed 64 characters.

    Variable Group

    The default is Default Variable Group. You can click the drop-down list to select other variable groups.

    Code

    Customize the code, which serves as the variable's reference name. It begins with the fixed prefix dp_glb. The code must meet the following requirements:

    • Must be globally unique.

    • Can only contain numbers, letters, and underscores (_).

    • Cannot exceed 64 characters in length (including the total length of dp_glb_).

    Note

    The code is case-insensitive. Uppercase letters will be automatically converted to lowercase letters.

    Permission Control

    When enabled, permission must be requested the first time the created global variable is referenced.

    Code Review

    When enabled, you can designate a code reviewer. If this global variable is referenced in code, the code reviewer must approve the submission.

    Description

    Customize the description. This is the note information for the global variable.

    Variable Value

    Production And Development Environment Isolation

    • Disabled: The production and development environments use the same variable value.

    • Enabled: You can set different values for the production and development environments. The development value is used during debugging in the development environment. The production value is used during scheduled production runs and manual operations.

    Variable Value

    Set the variable value for the production or development environment. The value is case-sensitive.

    • Common Variable: Cannot exceed 512 characters.

    • Account Password: Cannot exceed 5000 characters.

    Date and time

    Parameter

    Description

    Basic Information

    Variable Name

    Customize the variable name. Cannot exceed 64 characters.

    Code

    Customize the code, which serves as the variable's reference name. It begins with the fixed prefix dp_glb. The code must meet the following requirements:

    • Must be globally unique.

    • Can only contain numbers, letters, and underscores (_).

    • Cannot exceed 64 characters in length (including the total length of dp_glb_).

    Note

    The code is case-insensitive. Uppercase letters will be automatically converted to lowercase letters.

    Variable Group

    The default is Default Variable Group. You can click the drop-down list to select other variable groups.

    Permission Control

    When enabled, permission must be requested the first time the created global variable is referenced.

    Code Review

    When enabled, you can designate a code reviewer. If this global variable is referenced in code, the code reviewer must approve the submission.

    Description

    Customize the description. This is the note information for the global variable.

    Variable Value

    Production And Development Environment Isolation

    • Disabled: The production and development environments use the same variable value.

    • Enabled: You can set different values for the production and development environments. The development value is used during debugging in the development environment. The production value is used during scheduled production runs and manual operations.

    Baseline Date Type is set to Data Timestamp (bizdate-yyyymmdd)

    Applicable to all nodes.

    • Variable Output Format: The format of the result value after the date and time variable calculation. Click the drop-down list to select from the following formats:

      • yyyyMMdd: YYYYMMDD. For example, 20220604.

      • yyyy-MM-dd: year-month-day. For example, 2022-06-04.

      • yyyy/MM/dd: year/month/day. For example, 2022/06/04.

      • yyyyMMddHHmmss: YYYYMMDDHHMMSS. For example, 20220604000000.

      • yyyy-MM-dd HH:mm:ss: year-month-day hour:minute:second. For example, 2022-06-04 00:00:00.

      • unixtimestamp: UNIX timestamp, representing the number of seconds since January 1, 1970, 00:00:00. For example, 2022-06-04 00:00:00 converted to a UNIX timestamp is displayed as 1654272000.

    • Quick Date Selection: Commonly used variable dates.

      After setting Quick Date Selection, the corresponding calculation logic is automatically populated in Variable Date. You can also customize the Variable Date settings.

    • Preview Baseline Date: The baseline date used when previewing the variable value, used only for previewing configuration effects.

    • Variable Date: Defines the calculation logic for the variable, using the baseline date as input and performing offsets in the dimensions of Year, Quarter, Month, Week, and Day.

      If Add Offset Time is enabled, the input date for each row's calculation is the output date from the previous row's calculation.

      After configuring Variable Date:

      • In Date Preview, you can view the date obtained from this row's calculation.

      • In Variable Output Format, you can view the variable value after this row's calculation, displayed according to your selected Variable Output Format.

    Baseline Date Type is set to Business Time (bizdatetime-yyyymmddhhmmss)

    Only used for nodes scheduled by hour or minute.

    • Variable Output Format: The format of the result value after the date and time variable calculation. Click the drop-down list to select from the following formats:

      • yyyyMMdd: YYYYMMDD. For example, 20220604.

      • yyyy-MM-dd: year-month-day. For example, 2022-06-04.

      • yyyy/MM/dd: year/month/day. For example, 2022/06/04.

      • yyyyMMddHHmmss: YYYYMMDDHHMMSS. For example, 20220604000000.

      • yyyy-MM-dd HH:mm:ss: year-month-day hour:minute:second. For example, 2022-06-04 00:00:00.

      • unixtimestamp: UNIX timestamp, representing the number of seconds since January 1, 1970, 00:00:00. For example, 2022-06-04 00:00:00 converted to a UNIX timestamp is displayed as 1654272000.

    • Quick Date Selection: Commonly used variable dates.

      After setting Quick Date Selection, the corresponding calculation logic is automatically populated in Variable Date. You can also customize the Variable Date settings.

    • Preview Baseline Time: The baseline time used when previewing the variable value, used only for previewing configuration effects.

    • Variable Date: Defines the calculation logic for the variable, using the baseline date as input and performing offsets in the dimensions of Year, Quarter, Month, Week, and Day.

      If Add Offset Time is enabled, the input date for each row's calculation is the output date from the previous row's calculation.

      After configuring Variable Date:

      • In Date Preview, you can view the date obtained from this row's calculation.

      • In Variable Output Format, you can view the variable value after this row's calculation, displayed according to your selected Variable Output Format.

    • Quick Time Selection: After setting Quick Time Selection, the corresponding calculation logic is automatically populated in Variable Time. You can also customize the Variable Time settings.

    • Variable Time: Defines the calculation logic for the variable, using the baseline date as input and performing offsets in the dimensions of Day, Hour, Minute, and Second.

      If Add Offset Time is enabled, the input date for each row's calculation is the output date from the previous row's calculation.

      After configuring Variable Time:

      • In Time Preview, you can view the time obtained from this row's calculation.

      • In Variable Output Format, you can view the variable value after this row's calculation, displayed according to your selected Variable Output Format.

  3. Click OK to complete the creation of the global variable.

Manage variable groups and global variables

Operations supported for variable groups

Note
  • The Default Variable Group does not support edit or delete operations.

  • Variable groups that contain variables do not support edit or delete operations.

Operation

Description

Edit

Edit the name and code of the variable group.

  1. Click the Edit icon in the Actions column (the last column in the global variable list) of the target variable group to open the Edit Variable Group dialog box.

  2. In the Edit Variable Group dialog box, edit the Name and Code of the variable. The naming requirements are the same as those for creating a new variable group. For more information, see Create a variable group.

  3. After you complete the editing, click OK.

Delete

Click the Delete icon in the Actions column (the last column in the global variable list) of the target variable group to delete the current variable group.

Operations supported for global variables

Note

System variables do not support any operations.

Operation

Description

Search

After you enter keywords in the search bar, the system automatically matches variable names, codes, and values/calculation logic (excluding values of account password type variables) and filters out relevant global variables.

Edit

Click the Edit icon in the Actions column (the second-to-last column in the global variable list) of the target global variable to open the Edit Global Variable dialog box. In the dialog box, edit the relevant parameters. The parameter configuration is the same as that for creating a new global variable. For more information, see Create a global variable. After you complete the editing, a new version is generated.

Note
  • The Account Password and Date and Time type global variables do not support modifying the Variable Type.

  • Common Variables can be converted to Account Password type variables. After the conversion, permission control and code review are automatically enabled. Production nodes that currently reference this variable will have no permissions by default. Please grant permissions in advance.

View Dependencies

View all integration and computing nodes that reference the current global variable and have been submitted.

  1. Click the View Dependencies icon in the Actions column (the second-to-last column in the global variable list) of the target global variable to open the View Dependencies dialog box.

  2. The dependency object list displays the Object Name, Object Space, File Format, and Reference Time. You can click the View icon in the Actions column of the target object to navigate to the corresponding integration or computing node development page.

Delete

Important

You can only delete global variables that have no dependencies. Deleted variables cannot be recovered. Please proceed with caution.

Click the Delete icon in the Actions column (the second-to-last column in the global variable list) of the target global variable. In the dialog box that appears, click Confirm to complete the deletion.

View Version History

Click the View Version History icon in the Actions column (the second-to-last column in the global variable list) of the target global variable. In the View Version History dialog box, you can view the version list, which includes Version Number, Submitted By, Submitted At, Value/Calculation Logic, and Description. You can click the Compare Versions or Roll Back Version icon in the Actions column of the target version to perform the corresponding operation.

  • Compare Versions: Navigate to the version comparison page. By default, the current version is compared with the selected version, and the differences are highlighted.

  • Roll Back Version: Click the Roll Back Version icon in the Actions column of the corresponding version to roll back to that version.

    Note

    When rolling back a version, if the current version is an account password type variable and the target version is a common variable, the variable type will be converted to a common variable after rolling back to the target version.

Request Permission

Click the More icon in the Actions column (the second-to-last column in the global variable list) of the target global variable, and select Request Permission. You will be redirected to the Request Variable Permission dialog box. Fill in the relevant parameter configurations to complete the permission request. For more information, see Request, renew, and return variable permissions.