kql - 包含数组中一个单元格的数据表
kql - datatable with one cell from an array
如何使用数组中的一个单元格创建数据表?
我有这个作为输入:
let arr = dynamic ([
"Harjumaa",
"Tallinn",
"Lastekodu",
"24",
""
]);
此代码有效:
let dt = datatable(value:dynamic)
[
dynamic([
"",
"Harjumaa",
"Tallinn",
"Lastekodu",
"24",
""
]),
];
let cleanedArr = dt
| mv-apply value on (
summarize value = make_list_if(value, isnotempty(value))
);
print toscalar(cleanedArr);
但我需要使用 arr
变量作为输入
let arr = dynamic ([
"Harjumaa",
"Tallinn",
"Lastekodu",
"24",
""
]);
print source_arr = arr
| mv-apply a = source_arr on (summarize clean_arr = make_list_if(a, isnotempty(a)))
+--------------------------------------------+-----------------------------------------+
| source_arr | clean_arr |
+--------------------------------------------+-----------------------------------------+
| ["Harjumaa","Tallinn","Lastekodu","24",""] | ["Harjumaa","Tallinn","Lastekodu","24"] |
+--------------------------------------------+-----------------------------------------+
或者
let arr = dynamic ([
"Harjumaa",
"Tallinn",
"Lastekodu",
"24",
""
]);
print dummy = 0
| mv-apply a = arr on (summarize clean_arr = make_list_if(a, isnotempty(a)))
+-------+-----------------------------------------+
| dummy | clean_arr |
+-------+-----------------------------------------+
| 0 | ["Harjumaa","Tallinn","Lastekodu","24"] |
+-------+-----------------------------------------+
如何使用数组中的一个单元格创建数据表?
我有这个作为输入:
let arr = dynamic ([
"Harjumaa",
"Tallinn",
"Lastekodu",
"24",
""
]);
此代码有效:
let dt = datatable(value:dynamic)
[
dynamic([
"",
"Harjumaa",
"Tallinn",
"Lastekodu",
"24",
""
]),
];
let cleanedArr = dt
| mv-apply value on (
summarize value = make_list_if(value, isnotempty(value))
);
print toscalar(cleanedArr);
但我需要使用 arr
变量作为输入
let arr = dynamic ([
"Harjumaa",
"Tallinn",
"Lastekodu",
"24",
""
]);
print source_arr = arr
| mv-apply a = source_arr on (summarize clean_arr = make_list_if(a, isnotempty(a)))
+--------------------------------------------+-----------------------------------------+
| source_arr | clean_arr |
+--------------------------------------------+-----------------------------------------+
| ["Harjumaa","Tallinn","Lastekodu","24",""] | ["Harjumaa","Tallinn","Lastekodu","24"] |
+--------------------------------------------+-----------------------------------------+
或者
let arr = dynamic ([
"Harjumaa",
"Tallinn",
"Lastekodu",
"24",
""
]);
print dummy = 0
| mv-apply a = arr on (summarize clean_arr = make_list_if(a, isnotempty(a)))
+-------+-----------------------------------------+
| dummy | clean_arr |
+-------+-----------------------------------------+
| 0 | ["Harjumaa","Tallinn","Lastekodu","24"] |
+-------+-----------------------------------------+