Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
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}
in
List.Skip( alist, (x)=>
Value.Is(x, type text) )
or
= let alist = {"a","b","c",2,2,2}
in
List.Select( alist, (x)=>
Value.Is(x, type text) )thes work as expected, but is you cause an error,
= let alist = {"a"+2,"a","c",2,2,2}
, skipper = List.Skip( alist, (x)=> not
Value.Is(x, type text) )
in skipperSo the first value = error which is not text , so why does it not skip this and then continue, and is there a way to skip or select non error values?
Richard
Solved! Go to Solution.
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
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.
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.
Thanks, yes I had tried nesting a try / otherwise within it and as you said it don't work.
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
Thanks, supprisingly tricky as it looks like quite a straighforward problem.
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
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 7 | |
| 4 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 11 | |
| 11 | |
| 10 | |
| 7 | |
| 6 |