I would like to conditionally add a Match
result to a Union
.
That’s what I came up with:
Query(
Lambda(
["h264", "h265", "vp9"],
Union(
[
If(Var("h264"), Match(Index("VideoUpload_preset_status"), ["h264", "DONE"]), []),
If(Var("h265"), Match(Index("VideoUpload_preset_status"), ["h265", "DONE"]), []),
If(Var("vp9"), Match(Index("VideoUpload_preset_status"), ["vp9", "DONE"]), []),
],
)
)
)
If I run this function with any falsy argument, I get:
Error: [
{
"position": [],
"code": "call error",
"description": "Calling the function resulted in an error.",
"cause": [
{
"position": [
"expr",
"union"
],
"code": "invalid argument",
"description": "Arguments cannot be of different types, expected Set or Array."
}
]
}
]
It looks like I need to use something other than []
as my false_expr
argument to the If
functions. The question then is: how can I generate an empty Set?