Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Shifts the values inside a dynamic array to the left.
array_shift_left(
array, shift_count [,
default_value ])
Learn more about syntax conventions.
Name | Type | Required | Description |
---|---|---|---|
array | dynamic |
✔️ | The array to shift. |
shift_count | int |
✔️ | The number of positions that array elements are shifted to the left. If the value is negative, the elements are shifted to the right. |
default_value | scalar | The value used for an element that was shifted and removed. The default is null or an empty string depending on the type of elements in the array. |
Returns a dynamic array containing the same number of elements as in the original array. Each element has been shifted according to shift_count. New elements that are added in place of removed elements have a value of default_value.
Shifting to the left by two positions:
print arr=dynamic([1,2,3,4,5])
| extend arr_shift=array_shift_left(arr, 2)
Output
arr | arr_shift |
---|---|
[1,2,3,4,5] | [3,4,5,null,null] |
Shifting to the left by two positions and adding default value:
print arr=dynamic([1,2,3,4,5])
| extend arr_shift=array_shift_left(arr, 2, -1)
Output
arr | arr_shift |
---|---|
[1,2,3,4,5] | [3,4,5,-1,-1] |
Shifting to the right by two positions by using negative shift_count value:
print arr=dynamic([1,2,3,4,5])
| extend arr_shift=array_shift_left(arr, -2, -1)
Output
arr | arr_shift |
---|---|
[1,2,3,4,5] | [-1,-1,1,2,3] |
- To shift an array to the right, use array_shift_right().
- To rotate an array to the right, use array_rotate_right().
- To rotate an array to the left, use array_rotate_left().