1. Use Cases
Data preparation is a key feature of the YiDA low-code platform. It helps enterprise users cleanse, integrate, and transform raw data before conducting data analysis or building apps. Data preparation uses a zero-code ETL (Extraction Transformation Loading) approach to process data from YiDA apps, external enterprise databases, file-based data, and DingTalk official data sources (including Employee Roster, OA, Smart HR, and Attendance). By building data processing pipelines, it consolidates scattered data into standardized datasets that support visual analysis and data-driven decision-making.3. Formula Configuration Entry
Path: App settings > Data Factory > Data Preparation > Create data preparation > Select dataset. Formulas can be configured on association, aggregation, and cleansing nodes. Watch the video below for setup instructions:4. Logical Processing
CASEWHEN
Usage 1: CASEWHEN(<condition>,<value>,<condition>,<value>…). Equivalent to the CASE WHEN syntax in SQL. Example: CASEWHEN(<Gender field>=“Male”,“male”,<Gender field>=“Female”,“female”). Values of “Male” are replaced with “male”, and values of “Female” are replaced with “female”. Usage 2: CASEWHEN(<condition>,<value>,<condition>,<value>…<value>). Equivalent to the CASE WHEN syntax in SQL. Example: CASEWHEN(<Gender field>=“Male”,“male”,“female”). Values of “Male” are replaced with “male”, and any other value is replaced with “female”.5. Text Processing
LEN
Usage: LEN([string field]). Returns the length of the string. Example: LEN(“test”) returns 4. LEN(“测试”) returns 2. One Chinese character counts as one English character.LEFT
Usage: LEFT(<measure field>,< n >). Returns a string of length n starting from the first character on the left of the <field> value. Example: LEFT(Field1,3) returns “ABC” when the value of Field1 is “ABCDEF”.RIGHT
Usage: RIGHT(<measure field>,< n >). Returns a string of length n counted from the right of the <field> value. Example: RIGHT(Field1,3) returns “DEF” when the value of Field1 is “ABCDEF”.MID
Usage: MID(<measure field>, < start >, < n >). Returns a string of length n starting from the start-th character (counted from the left) of the <field> value. Example: MID(Field1, 3, 3) returns “CDE” when the value of Field1 is “ABCDEF”.POS
Usage: POS(<measure field>,<substring>). Returns the position of <substring> in <text>. Returns 0 if no match is found. Example: POS(Field1,“DE”) returns 4 when the value of Field1 is “ABCDEF”.UPPER
Usage: UPPER(<measure field>). Converts the value of <field> to uppercase. Example: UPPER(Field1) returns “ABCDEF” when the value of Field1 is “AbcdeF”.LOWER
Usage: LOWER(<measure field>). Converts the value of <field> to lowercase. Example: LOWER(Field1) returns “abcdef” when the value of Field1 is “AbcdeF”.VAL
Usage: VAL(<measure field>). Converts a text-type <field> value to a numeric type. Example: VAL(Field1) returns 123 when the value of Field1 is “123”.LEFTTRIM
Usage: LEFTTRIM(<measure field>). Removes leading spaces from the <field> value. Example: LEFTTRIM(Field1) returns “ABC” when the value of Field1 is ” ABC”.RIGHTTRIM
Usage: RIGHTTRIM(<measure field>). Removes trailing spaces from the <field> value. Example: RIGHTTRIM(Field1) returns “ABC” when the value of Field1 is “ABC ”.NUMBERTOSTRING
Usage: NUMBERTOSTRING(<number>). Converts numeric data to a string. Example: NUMBERTOSTRING(Field1) returns “12345” when the value of Field1 is “12345 ”.SPLITPART
Usage: SPLITPART(<string field>, delimiter, substring position). Splits a string into N substrings by the delimiter (where N equals the number of delimiters plus 1). The substring position is counted from 1 (left to right) or from -1 (right to left). Example: SPLITPART(<Field1>,A,2) returns “BCD” when the value of Field1 is “ABCDABHABC”. Setting the substring position to -5 also returns “BCD”.CONCAT
Usage: CONCAT(<field>,<field>,…). Concatenates multiple fields into a single string. Input parameters must be string-type fields. Example: CONCAT(<Field1>,<Field2>) returns “ABCD” when the value of Field1 is “A” and the value of Field2 is “BCD”.REPLACE
Usage: REPLACE([string], [search string], [replacement string]). Returns the string after replacement. Example: REPLACE([Field1], [Field2], [Field3]) returns “a12345efg” when Field1 is “abcdefg”, Field2 is “bcd”, and Field3 is “12345”.6. Time Processing
NOW
Usage: NOW(). Returns the current time, accurate to the second. Example: N/ADATEFORMAT
Usage: DATEFORMAT(<Date field>,<time format>). Formats a date as a string. The format for both functions follows the Java date formatting convention. The supported format types are:- yyyy: Year
- MM: Month
- dd: Day
- hh: 12-hour clock (1-12)
- HH: 24-hour clock (0-23)
- mm: Minute
- ss: Second
DATEADD
Usage:DATEADD(<Time field>,<offset>,<time granularity>). Adds an <offset> of the specified <time granularity> to the <Time field>.
- Time granularity values:
- The offset is a specific number to add or subtract. A positive value adds, and a negative value subtracts.
DATEADD(Date component,10,"DAY") = 20200911.
Example 2:
If the Date component value is “20200901”, then DATEADD(Date component,-1,"DAY") = 20200831.
The default date display format is
yyyyMMdd. To change the display format, refer to the example in the DATEFORMAT function.DATEDIFF
Usage: DATEDIFF(<Time field 1>,<Time field 2>,<time granularity>). Returns the difference between Time field 1 and Time field 2 at the specified time granularity. Time granularity options:- YEAR Year
- MONTH Month
- DAY Day
- HOUR Hour
- MINUTE Minute
- SECOND Second
FROMUNIXTIME
Usage: Converts a numeric Unix time value to a date value. Function declaration:- unixtime: Bigint type. The number of seconds in Unix date-time format. Values of string, double, or decimal type are implicitly converted to bigint before the operation.
- Return value: Datetime type. Returns NULL if unixtime is NULL.