Home > database >  kql - how to remove all empty strings from an array of strings?
kql - how to remove all empty strings from an array of strings?

Time:02-16

Please tell is it possible to remove all empty strings from an array of strings?

[
    "",
    "Harjumaa",
    "Tallinn",
    "Lastekodu",
    "24",
    ""
]

[
    "Harjumaa",
    "Tallinn",
    "Lastekodu",
    "24"
]

CodePudding user response:

you can use mv-apply make_list_if():

datatable(value:dynamic)
[
    dynamic([
        "",
         "Harjumaa",
         "Tallinn",
         "Lastekodu",
         "24",
         ""
    ]), 
]
| mv-apply value on (
    summarize value = make_list_if(value, isnotempty(value))
)
value
[
"Harjumaa",
"Tallinn",
"Lastekodu",
"24"
]
  • Related