Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Cada uno, enumerar las transformaciones y escribir el error de acceso al campo de texto

Tratando de destilar mi problema tanto como sea posible:

Tengo una serie de registros, a partir de los cuales quiero crear una tabla con varias columnas, cada columna que llama a una función diferente con el registro como argumento.

let
    Repos = Table.FromRecords({
    [CustomerName = "Bob"],
    [CustomerName = "Jim"],
    [CustomerName = "Alice"],
    [CustomerName = "Paula"]
}),
     subItems = Table.ToList(Repos),
    objects = List.Transform(subItems, each 
    Table.FromRecords({[Name = [CustomerName], Key = Text.Combine({"Key for ", [CustomerName]}), Data = Text.Combine({"Data for ",[CustomerName]}), ItemKind = "Table", ItemName = "Table", IsLeaf = true]} ))
in
    objects

Esto me da lo que inicialmente parece ser correcto:

image.png

Sin embargo, al expansión me

image.png

Error de expansión da

Expression.Error: No podemos aplicar acceso de campo al tipo Texto.
Detalles:
Valor-Bob
Clave-Nombre_cliente

¿Algún puntero o idealmente una documentación con más ejemplos?

Gracias de antemano,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Al final era más fácil tomar la tabla inicial y agregar columnas (Table.AddColumn...) usando como columnGenerator un each (algo) que llamaba a las funciones relevantes.

En otras palabras, el siguiente código

let
    Repos = Table.FromRecords({
    [CustomerName = "Bob"],
    [CustomerName = "Jim"],
    [CustomerName = "Alice"],
    [CustomerName = "Paula"]
}),
    ReposWithKey = Table.AddColumn(Repos,"Key", each Text.Combine({"Key for ", [CustomerName]})),
    ReposWithData = Table.AddColumn(ReposWithKey, "Data", each Text.Combine({"Data for ",[CustomerName]})),
    ReposWithItemKind = Table.AddColumn(ReposWithData, "ItemKind", each "Table"),
    ReposWithItemName = Table.AddColumn(ReposWithItemKind, "ItemName", each "Table"),
    ReposWithLeaf = Table.AddColumn(ReposWithItemName, "isLeaf", each "true")
in
    ReposWithLeaf

hizo el truco

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Al final era más fácil tomar la tabla inicial y agregar columnas (Table.AddColumn...) usando como columnGenerator un each (algo) que llamaba a las funciones relevantes.

En otras palabras, el siguiente código

let
    Repos = Table.FromRecords({
    [CustomerName = "Bob"],
    [CustomerName = "Jim"],
    [CustomerName = "Alice"],
    [CustomerName = "Paula"]
}),
    ReposWithKey = Table.AddColumn(Repos,"Key", each Text.Combine({"Key for ", [CustomerName]})),
    ReposWithData = Table.AddColumn(ReposWithKey, "Data", each Text.Combine({"Data for ",[CustomerName]})),
    ReposWithItemKind = Table.AddColumn(ReposWithData, "ItemKind", each "Table"),
    ReposWithItemName = Table.AddColumn(ReposWithItemKind, "ItemName", each "Table"),
    ReposWithLeaf = Table.AddColumn(ReposWithItemName, "isLeaf", each "true")
in
    ReposWithLeaf

hizo el truco

v-xicai
Community Support
Community Support

Hola @whiskas1983 ,

Puede consultar los enlaces:

https://community.powerbi.com/t5/Desktop/quot-Expression-Error-We-cannot-apply-field-access-to-the-t...

https://community.powerbi.com/t5/Desktop/We-cannot-apply-field-access-to-the-type-List/td-p/851856

https://community.powerbi.com/t5/Power-Query/Expression-Error-We-cannot-apply-field-access-to-the-ty...

Saludos

Amy

Equipo de apoyo a la comunidad _ Amy

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

lbendlin
Super User
Super User

¿Cuál es tu razón para no empezar con una lista?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.