List.TransformMany in List.Generate => Error

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

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.
23,693 questions
No comments
{count} votes

Accepted answer
  1. answered 2021-05-07T23:50:09.37+00:00
    Ehren (MSFT) 1,771 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