08-17-2020 03:20 PM
Judging from the options available in the Aggregate Snap, I would expect it to work much like the identically named aggregate functions in SQL. SQL functions like COUNT, AVG, SUM, and MAX conveniently skip over NULLs and return the same values as they would if the NULLs were not there.
However, for CONCAT this does not appear to be the case.
I am running into problems when the attribute I am trying to aggregate from the document stream either does not exist or is null.
For example, if I had $original.foo as the input field in the document stream that looked something like (‘abc’, ‘xyz’, null, ‘aa’, undefined, ‘bb’) and was mapping CONCAT of that to an output field “bar”, I would expect bar to look like: “abc|xyz|aa|bb”. Instead I get errors: ‘foo was not found while evaluating the sub-expression “$original.foo”’ and ‘$original.original.LegacyKey is undefined. Perhaps you meant…’
How do I write the input field expression so nulls and undefineds are simply ignored?
Or is this a bug in CONCAT / Aggregate?
Thanks in advance!
(PS: I don’t think I want a string with back-to-back delimiters, e.g. “abc|xyz||aa||bb” if I can avoid it, but even that would be better than failing on error.)
Solved! Go to Solution.
08-17-2020 04:36 PM
$.filter((value, key) => (key==“foo” && value!=“null”))
For reference.
Community1_2020_08_17.slp (7.2 KB)
08-17-2020 04:36 PM
$.filter((value, key) => (key==“foo” && value!=“null”))
For reference.
Community1_2020_08_17.slp (7.2 KB)