Compute tags use visual expressions to calculate tag values from existing tags. You can create a compute tag by defining processing rules in the expression editor.
Prerequisites
Create the corresponding entity before you create an offline tag. For more information, see Create and Manage Entities.
Procedure
-
On the Dataphin home page, navigate to the top menu bar and select Tag > Tag Workbench.
-
Select Project from the top menu bar.
-
In the left-side navigation pane, choose Tag Processing > Offline Tag.
-
On the Offline Tag page, click the Project Tags tab. Then, under the Project Tags tab, click Add Tag.
-
In the Add Offline Tag dialog box, select Compute Tag.
-
Configure the Basic Information for both Business Attribute and Technical Attribute in Step 1.
-
Business Attribute
Parameter
Description
Tag Name
Enter the tag name. Supports Chinese, English, numbers, and underscores (_), up to 64 characters.
Entity-Entity ID
Select the entity and entity ID based on your business needs.
Tag Type
Classifies tags by processing method.
-
Attribute Tag: Describes objective facts and serves as the most basic tag for entity profiles, such as gender and name.
-
Statistical Tag: Derived from statistical calculations on entity behavior or attributes, such as the purchase amount over the last 7 days.
-
Predictive Tag: Predicts entity characteristics or behavior using algorithm models, such as a user's predicted province of residence.
-
Composite Tag: Combines and processes multiple tags by specific rules, such as consumer segmentation.
-
Compute Tag: Derived from mixed calculations across different tags, such as gross profit margin and income level.
Timeliness
Describes how frequently a tag updates over time. Options are dynamic and static, with dynamic selected by default.
-
Static: Describes inherent entity characteristics that typically do not change over time, such as gender and name.
-
Dynamic: Requires dynamic updates to maintain accuracy, such as the order amount over the last 7 days.
Owner
Select the owner of the tag. The current user is selected by default.
Tag Description
A brief description of the tag, up to 1,000 characters.
-
-
Technical Attribute
Parameter
Description
Tag Code
A globally unique identifier for the tag. Helps distinguish tags that share the same name. Must start with a lowercase letter and allows lowercase letters, numbers, and underscores (_), up to 64 characters.
Tag Update Method
Supports Periodic Update and Manual Update.
-
Periodic Update: Automatically updates the tag at specified time intervals.
-
Manual Update: Updates the tag through manual operations.
-
-
-
Click Next.
-
On the Processing Logic page, configure the Processing Logic settings for the compute tag.
Parameter
Description
Version Number
Enter a version number name. Default is
V1. Supports letters, numbers, underscores (_), hyphens (-), and half-width periods (.), up to 64 characters.Value Type
Supported types: string, long integer, double precision floating point, date, Boolean, and decimal. The default for decimal is Decimal(38,18).
Lookup Table
Only integer, Boolean, and string value types support lookup tables.
-
Click
to enter the Configure Lookup Table dialog box. -
In the Configure Lookup Table dialog box, configure the relevant parameters.
-
Configure Lookup Table: Not configured by default. Select Reference Tables to configure a lookup table for the metric.
-
Lookup Table Source: Only Manual Configuration is supported.
-
Lookup Table Name: Supports Chinese, English, numbers, and special characters, up to 128 characters.
-
Lookup Table Description: A brief description of the lookup table, up to 1,000 characters.
-
Code Information: Supports single and batch input, up to 500 groups.
-
Single Input: Click Add Code Value, then enter a Code Value and Code Name. Both fields are required and must be unique. The code value type must match the value type of the metric. Click
to delete a row. -
Batch Input: Click Batch Input. In the Batch Input Code Information dialog box, enter code values and code names with each group on a separate line, separated by a half-width colon (:). Click Click To Detect to automatically parse and populate the code information list.
-
One-click Purge: Click One-click Purge to clear the code information list.
-
-
-
Click Confirm to complete the code value configuration.
NoteIf duplicate code values or code names exist in batch input, the system automatically locates the first error row after you click confirm.
Tag Configuration
-
Select Tag: Click Select Tag to choose tags from the left tag list and reference them in the expression editing area. The tag list supports all tags, project tags, and applied tags. You cannot select the current tag. Click Tag Market at the bottom to find or apply for more tags.
Click Collapse Tag to collapse the left tag list.
-
Select Function: Click Select Function to choose a function from the right function list and reference it in the expression editing area. The function list contains system functions (single-line functions) under the current tenant compute engine, organized by category. You can search by function name. Click the
icon to view function details, including the function name, type, command format, and description. Click the
icon to copy the function name.Click Collapse Function to collapse the right function list.
-
Format: Click Format to automatically format the code in the expression editing area.
-
Syntax Reference Tips:
-
Arithmetic operation: Supports addition
+, subtraction-, multiplication*, division/, and parentheses() -
Logical operation: Supports and
&&, or||, not!,in,not in -
Relational operation: Supports greater than
>, less than<, greater than or equal to>=, less than or equal to<=, equal to==, not equal to!= -
Conditional expressions only support CASE WHEN. When using CASE WHEN, only content that conforms to the CASE WHEN format is allowed in the editing area.
-
Supports built-in single-line functions in the engine, such as:
ROUND( @feature.total_liabilities / @feature.total_assets, 2 )
-- Arithmetic operations “ +, -, *, /, () ”-- -- Numeric tags: All arithmetic operators above can be used for arithmetic operations FLOOR( ( @feature.resign_num + @feature.pre_resign_num ) / @feature.total_worker, 2 ) -- Logical operations: and &&, or ||, not !, in, not in -- Relational operations: greater than >, less than <, greater than or equal to >=, less than or equal to <=, equal to ==, not equal to != -- Selection operations: CASE WHEN THE BETWEEN AND ELSE END -- Logical relational operations are generally used for condition judgment -- Overwrite the original selection logic, along with the layered tag logic, and the complex metric calculation logic, but only supports one layer of nesting CASE WHEN condition1 THEN value1 WHEN condition2 THEN value2 WHEN condition3 THEN value3 ELSE default_value END -- Metric layered tags CASE WHEN @feature.salary < 3000 THEN 'Low' WHEN @feature.salary BETWEEN 3000 AND 5000 THEN 'Medium' WHEN @feature.salary > 5000 THEN 'High' ELSE 'Unknown' END -- Complex tax calculation CASE WHEN @feature.salary < 36000 THEN 0 WHEN @feature.salary BETWEEN 36000 AND 100000 THEN @feature.salary×0.05 ELSE @feature.salary×0.1 END -
-
Syntax Validation: Click Syntax Validation to validate the existence and validity of the code in the expression editing area. The validation rules are as follows:
-
Existence Validation: Checks whether the referenced tags and functions exist. If not, an error is reported with details for troubleshooting.
-
Validity Validation: Checks for invalid characters and whether SQL can be correctly generated. If invalid characters are found or the tag processing logic cannot be parsed, an error is reported with details for troubleshooting.
-
-
-
Click Submit to finalize the creation of the offline tag.
After creating the offline tag, publish it to make it available. Published tags can be used by project members for further processing or audience group selection.
-
In the offline tag list, click the
icon in the operation column to publish the tag. -
In the Publish Tag dialog box, choose the tag version to publish.
NoteBefore publishing, you can select View Version Comparison to examine the details and differences between versions, ensuring the correct version is published.
-
Click Confirm to complete the tag's publication process.
-
What to do next
After the offline tag is created and published, you can list it in the market for management and use it in further tag development. For more information, see Manage Tags.