Forum Discussion
Dicken
Post Prodigy
9 months agoPower Query List.Skip, Select
Can someone expalain why select / skip does not seem to handle errors, I have read something about lazy evaluation whch causes the whole thing to fail; so ; = let alist = {"a","b","c",2,2,2}...
- 9 months ago
let alist = {"a"+2,"a","c",2,2,2}, #"Removed Errors" = Table.RemoveRowsWithErrors(Table.FromColumns({alist}))[Column1], skipper = List.Select( #"Removed Errors", each Value.Is(_, type text) ) in skipper - 9 months ago
Function arguments are evaluated eagerily before they passed to a function body. So that your can't even use try ... otherwise from within a function to go around the error when your "x" argument in List.Skip is error itself. You need to use somthing that may contain this error - e.g. a table. This is what lbendlin did. Another example is
Table.Skip( Table.FromColumns({{"a"+2,"a","c",2,2,2}}, {"lst"}), (x) => try x[lst] is text otherwise true )[lst]Read Ben Gribaudo's Primer for more info about error handling in M.
lbendlin
Super User
9 months agolet
alist = {"a"+2,"a","c",2,2,2},
#"Removed Errors" = Table.RemoveRowsWithErrors(Table.FromColumns({alist}))[Column1],
skipper = List.Select( #"Removed Errors", each Value.Is(_, type text) )
in skipper- Dicken9 months ago
Post Prodigy
Thanks, supprisingly tricky as it looks like quite a straighforward problem.
- lbendlin9 months ago
Super User
The basic issue is that lists don't have native error handling. If this is important to you please consider voting for an existing idea or raising a new one at https://ideas.fabric.microsoft.com