Syntax
Parameters
input: an array of conditions. A maximum of 31 conditions can be passed in. Separate multiple conditions with commas.
Return value
Returns an array of 0 and 1. The number of 0 and 1 is the same as the number of input conditions. The evaluation starts from the first condition.- If the condition evaluates to true, 1 is returned. Otherwise, 0 is returned.
- If the first condition is not true, the current position and its following positions are all set to 0.
Examples
-
Create a table named
testand insert data. -
Query data from
test.Text -
Use
retentionto calculate user retention rate. Example 1: Evaluate user behavior against the following conditions: view commodity page on 2022-01-01 (action=‘pv’) and place an order on 2022-01-02 (action=‘buy’).In the result:Text- Users 1 and 5 meets two conditions and [1,1] is returned.
- User 2 does not meet the second condition and [1,0] is returned.
- User 3 meets the second condition but does not meet the first condition. [0,0] is returned.
- User 4 meets no condition and [0,0] is returned.
The return value is the user retention rate on 2022-01-02.Text