List.TransformMany in List.Generate => Error

Lz._ 8,986 Reputation points
2021-05-04T12:32:53.103+00:00

Hi

The following code raises Error "We cannot apply field access to the type Text...":

let  
    Alpha = {"A".."B"},  
    Go = List.Generate(()=>  
        [i = 0, Out = List.TransformMany(Alpha, each Alpha, (x,y)=> x & y)],  
        each [i] < 2,  
        each [i = [i]+1, Out = List.TransformMany(Alpha, each [Out], (x,y)=> x & y)],  
        each [Out]  
    )  
in  
    Go  

93518-error.png

Swapping the lists does it:

   each [i = [i]+1, Out = List.TransformMany([Out], each Alpha, (x,y)=> x & y)],  

However, I really don't understand why the initial code errors out - I must be missing something... I will highly appreciate your insight. Thanks

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,795 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ehren (MSFT) 1,781 Reputation points Microsoft Employee
    2021-05-07T23:50:09.37+00:00

    The problem is with the "each [Out]". This is shorthand for "(_) => _[Out]", which doesn't make sense in this context, since the letters in the Alpha list won't have an [Out] field. Instead, it should be (x) => [Out], which will reference the implicit _ identifier defined by the "each" at the beginning of the line.


0 additional answers

Sort by: Most helpful