Forum Discussion
leinad
3 years agoRegular Visitor
can't apply changes when accessing tables using the #shared environment
Hi everyone, I am trying to access some tables via their names as text using the #shared environment. Assuming for example I have the following two queries (called table1/table2 respectively): ...
- 3 years ago
leinad Maybe try something like this:
let Source = #shared, #"Converted to Table" = Record.ToTable(Source), #"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each if Type.Is(Value.Type([Value]), Table.Type) then 1 else 0), #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = 1)), #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Value"}) in #"Removed Columns"
Greg_Deckler
Community Champion
3 years agoleinad I don't understand why you are using #shared here. There is no reason to do so. Just write your last two queries like this:
let
first_table = table1
in
first_tablelet
first_table = table1,
sec_table = table2,
res = Table.Combine({first_table, sec_table})
in
resleinad
3 years agoRegular Visitor
Greg_DecklerThanks for your response. In this case i agree. However, this is just some dummy data to replicate the error. I just wanted to understand why the error messages occur.
The actual usecase is using a function to generate all the names of the tables which are to be combined and depends on a parameter for the number of tables. I hope that makes it a little bit clearer.
- Greg_Deckler3 years ago
Community Champion
leinad Maybe try something like this:
let Source = #shared, #"Converted to Table" = Record.ToTable(Source), #"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each if Type.Is(Value.Type([Value]), Table.Type) then 1 else 0), #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([Custom] = 1)), #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Value"}) in #"Removed Columns"