question

Lz-3068 avatar image
0 Votes"
Lz-3068 asked Lz-3068 commented

List.TransformMany in List.Generate => Error

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

power-query-not-supported
error.png (12.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Ehren avatar image
0 Votes"
Ehren answered Lz-3068 commented

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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@Ehren. It now makes sense this didn't make sense :) Thanks much again

0 Votes 0 ·