Forum Discussion
Anonymous
6 years agoNot applicable
M Language - Custom Functions -> Passing a Table by a string name
This is very specific to writing a Power Query Custom Function. Keep that in mind when responding because I am not looking for a another way to do it without a Custom Function. I want to create ...
- Anonymous6 years ago
Here is the solution...
let
TargetTable = (TargetTableName as text) as table=>
let
TargetTable = Record.Field(#sections[Section1], TargetTableName)
in
TargetTable,
MyTable = TargetTable("ccontl")
in
MyTable
ImkeF
6 years agoCommunity Champion
Hi Anonymous ,
the definition of the output type is optional, so if you remove it, you can use this query to reference queries of any type.
let
fnTargetQuery = (TargetQueryName as text) =>
Record.Field(#sections[Section1], TargetQueryName),
CallFunction = fnTargetQuery("ccontl")
in
CallFunction
... code is slighty rewritten ...
Anonymous
6 years agoNot applicable
ImkeF Thanks alot this is a really powerfull pattern.