github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/funcs/md/group_between.en.md (about) 1 ### `group_between()` {#fn-group-between} 2 3 Function prototype: `fn group_between(key: int, between: list, new_value: int|float|bool|str|map|list|nil, new_key)` 4 5 Function description: If the `key` value is within the specified range `between` (note: it can only be a single interval, such as `[0,100]`), a new field can be created and assigned a new value. If no new field is provided, the original field value will be overwritten 6 7 Example 1: 8 9 ```python 10 # input data: {"http_status": 200, "code": "success"} 11 12 json(_, http_status) 13 14 # If the field http_status value is within the specified range, change its value to "OK" 15 group_between(http_status, [200, 300], "OK") 16 17 # result 18 # { 19 # "http_status": "OK" 20 # } 21 ``` 22 23 Example 2: 24 25 ```python 26 # input data: {"http_status": 200, "code": "success"} 27 28 json(_, http_status) 29 30 # If the value of the field http_status is within the specified range, create a new status field with the value "OK" 31 group_between(http_status, [200, 300], "OK", status) 32 33 # result 34 { 35 "http_status": 200, 36 "status": "OK" 37 } 38 ```