Forum Discussion
List.Select does not work as expected when List contains Errors
- 8 years ago
The reason for this behavior is that lists in M are lazy. The previews (in the Query Editor) of both the "each false" and "each true" queries actually produce the same result. In both cases, the Query Editor attempts to show all the values, which causes List.Select to traverse its entire source list. In the process, it encounters the error value, which interrupts its enumeration of the source list, resulting in a list that contains an error.
However, when you navigate into the first item in the resulting list, both the "each false" and "each true" queries attempt to get only the first item resulting from the List.Select. Since the "each true" query's List.Select condition will "match" any input, the “Hello” value is selected and returned, and the error value is never encountered. However, in the "each false" query, the first two inputs do not "match", and thus it moves on to the error value, which interrupts its enumeration and causes the error to bubble up.
Hope this helps clarify things.
Ehren
Hi elderfd,
I have sent a email to consult this issue internally, will update here once I get any information.
Best Regards,
Qiuyun Yu