Skip to content

TableRemove

根据索引下标删除数组元素。

Lua数组的索引下标是从 1 开始的

业务属性

属性含义说明输入限定示例值
enable是否启用该控件,未启用时不编译是否编译选择值启用
text与控件关联的文本设计页控件显示常量TableRemove
input输入参数流程变量#{array}
removeIndex删除索引空则默认删除数组最后元素常量/流程变量1

使用示例

输入常量

输入:#{body.array},删除索引输入:4,此时将删除下标索引为4的元素

img_12.png

输出控件返回body.arraydata属性为:

json
{
  "array": "#{body.array}"
}
{
  "array": "#{body.array}"
}
img_13.png

使用curl请求接口:

$ curl http://localhost:6636/api/tableRemove -d "{ \"array\": [1,2,3,4,5,6] }"
$ curl http://localhost:6636/api/tableRemove -d "{ \"array\": [1,2,3,4,5,6] }"

接口返回:

json
{
    "array": [1,2,3,5,6]
}
{
    "array": [1,2,3,5,6]
}

删除索引为空值

删除索引设置为空,此时将删除数组的最后一个元素

img_14.png

使用curl请求接口:

$ curl http://localhost:6636/api/tableRemove -d "{ \"array\": [1,2,3,4,5,6] }"
$ curl http://localhost:6636/api/tableRemove -d "{ \"array\": [1,2,3,4,5,6] }"

接口返回:

json
{
    "array": [1,2,3,4,5]
}
{
    "array": [1,2,3,4,5]
}

输入指定变量

删除索引输入:#{body.index}

img_15.png

使用curl请求接口:

$ curl http://localhost:6636/api/tableRemove -d "{ \"array\": [1,2,3,4,5,6], \"index\": 1 }"
$ curl http://localhost:6636/api/tableRemove -d "{ \"array\": [1,2,3,4,5,6], \"index\": 1 }"

接口返回:

json
{
    "array": [2,3,4,5,6]
}
{
    "array": [2,3,4,5,6]
}