Forum Discussion
transform a column for use as array in other PowerQuery commands
Hi spinfuzer
Thanx for prompt reply!
I couldn't get your code working, don't understande were you are referring to with #shared in:
shared_table = Table.Buffer(Record.ToTable(#shared)),
However, If I do understand it correctly, you create a "nested" list:
a list were each value contains another list.
I tried to do this in another way:
let
#"Source" = Excel.CurrentWorkbook(){[Name="DATADEF"]}[Content],
#"Filtered Rows" = Table.SelectRows(Source, each [TYPE] <> null and [TYPE] <> ""),
#"Added Column" = Table.AddColumn(#"Filtered Rows", "myColumn", each {[NAME],[TYPE]}),
#"myList" = #"Added Column"[myColumn],
#"Result"= #"myList"
in
#"Result"
Here I create a custom column "myColumn", with a calculated key/value pair {[NAME],[TYPE]}
This seems to work and -if I understood your code correctly- will give me the same result.
Above method works perfect for re-naming because creating a list with { [OLDNAME],[NEWNAME]} result in a list of key/value pairs that are both strings.
However, if I want to use this technique to change types, I receive following error:
This is because my (nested) list contains {[NAME],[TYPE]} and both are interpreted as strings, while [TYPE] should be interpreted as a typecast object, not as a string....
So basically what is happening here is:
and not
Is there a way to let powerquery "evaluate" the string "type date" to typecasting 'type date'
Should I dig further into your code because maybe I missed something and your list solves the above problem?
kind regards,
bartplessers