Forum Discussion
Parameter to switch between source queries
Like this?
let
Source = AppInsights,
#"Removed Other Columns" = Table.SelectColumns(Source,{"Browser"}),
#"Removed Duplicates" = Table.Distinct(#"Removed Other Columns"),
#"Renamed Columns" = Table.RenameColumns(#"Removed Duplicates",{{"Browser", "BrowserName"}}),
#"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 1, 1),
#"Renamed Columns1" = Table.RenameColumns(#"Added Index",{{"Index", "BrowserID"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns1",{{"BrowserID", Int64.Type}})
in
#"Changed Type"
-------------------
AppInsights is my parameter name. It still gives me this error on the second step:
Expression.Error: We cannot convert the value "AppInsightsSQL (Api)" to type Table.
Details:
Value=AppInsightsSQL (Api)
Type=Type
--------------
AppInsightsSQL (Api) is my default source query.
What am I missing here?
Thanks.
Hi RSK,
"Expression.Error: We cannot convert the value "AppInsightsSQL (Api)" to type Table.
Details:
Value=AppInsightsSQL (Api)
Type=Type"
<--- Modify Code as pattern below and check if it can work.
Source = Sql.Database(InstanceNames, Databases, [Query = "Select * from *"])(e.g.: InstanceNames and Databases are parameters)
Regards,
Jimmy Tao
- Anonymous8 years agoNot applicableThanks Jimmy, but as stated in my original post, only one of my sources is a SQL db, the other is an Azure Table Store. So that is why I need a parameter to switch between those two source queries regardless of the original sorce type. Hope it makes more sense now.
- v-yuta-msft8 years ago
Community Support
Hi RSK,
So your requirement is to change data source within different data connectors, right? Query parameter can't switch from one data connector to another, to change data connector, you should click "Get Data"-> "Azure Table Storage". After that, you can use query parameter to select connection info(e.g.: servername, instancename, web url, header).
Regards,
Jimmy Tao
- Anonymous8 years agoNot applicable
Yes I know how to swith connector manually, but I want from my referenced query, to be able to switch between two different source queries using a parameter, regardsless of those two source queries connecting to two different source-types (SQL and Azure Table) initially.
Is it not possible to parameterize which source query a referenced query is pointing at?
Thanks, and sorry if I am not making myself clear.