Dear Community,
I checked the null safety of my processes and functions and discovered an odd behavior for append()
append({},{1,2,3,4}) returns {1,2,3,4} as aspectedappend({null},{1,2,3,4}) returns five times a null value as "list of null"
1.) Can you verify this behavior?
2.) What would you do to reach a proper null save behavior?
kind regards and thank you in advance,Richard
Discussion posts and replies are publicly visible
I see that as well. What I see is that append() does a type cast towards the first array. Means when you have a list of nulls, any value you append will be casted to null.
Thank you stefan.For me, regarding null safety at least a kind of risk.Nevertheless I think the chance is not that high, to get just a null value instead of an empty array. The question is, if it makes sense to put a lot of effort into it.Any smooth ideas to avoid this?
I would use reject() to avoid passing the first one as {null}
For example:
reject(fn!isnull, append({null},{1, 2, 3,4}))
Can you just cast the null to an integer? Doing this worked for me:
append(tointeger({null}),{1,2,3,4})
Hi peter,I had the same idea yesterday
after a tointeger(null), the result is:
so that confirms stefans suggestion regarding the cast funcitonality towards the first array
Thank you for your input manuell