List.TransformMany in List.Generate => Error

Lz._ 8,991 Reputation points


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

    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]  


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,928 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ehren (MSFT) 1,781 Reputation points Microsoft Employee

    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