get_list_length
The get_list_length function can be used to calculate the number of elements in an array structure. Generally, this function is used together with the split function.
Syntax
get_list_length: list
Parameter Description
| Parameter | Parameter Description |
|---|---|
| list | Array structure |
Return Value
The length of an array is returned.
Examples
The following describes how to use the get_list_length function to obtain the length of an array:
inputs:
source:
default: "a,b,c,d,e,f,g"
node_templates:
testStack:
type: HuaweiCloud.AOS.Stack
properties:
templateId: "abcdf-fdeee"
inputs:
aaa: {select: [0, {split: [",", {get_input: source}]}]} # The value is a.
bbb: {select: [1, ["alpha", "beta", "gamma"]]} # The value is beta.
cc_length: {get_list_length: {split: [",", {get_input: source}]}} # The value is 7.
bbb_length: {get_list_length: ["alpha", "beta", "gamma"]} # The value is 3. Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.