mavo
mavo copied to clipboard
"Condense" function doesn't remove comas when there's no where condition {feature request}
Hi
while testing queries on nested collections: (codepen based on cats demo)
it seems that condense function must have a where condition to properly work
Wouldn't it be nice to make it work also without it?
Sometimes, we just need to remove empty values, without a 'complicated' where to let right values appear
I examined the issue @GalinhaLX faced and found that it's caused by the way Mavo treats absent values. Consider the following data:
{
"cat": [
{
"name": "Vector",
"age": 12
},
{
"name": "Jean"
}
]
}
In the Mavo Inspector, we can see that the (absent) age
property of the second cat is treated by Mavo as text (an empty string):

And since "" != null
and condense(list(12, null)) != condense(list(12, ""))
, we get 12,
as a result of condense(age)
.
If I'm not mistaken, the where
operator drops empty strings that's why condense(age where age)
returns the expected result.
Since condense()
is based on first()
, to fix condense()
we need to fix first()
first. It looks like we need to decide whether ""
and null
are equal.