Forum Discussion
Parametrize an OLE datasource for DEV/PROD env
Hi there
We have 2 environments QA and Prod and a single report. The schema and tables in both environments are same and data is different. Ideally, I would use a parameter to switch between the data sources but this is OleDb not SQLServer, so I can't.
Of course, I can modify my source like this:
let
Config = GetConfigString(),
Source = OleDb.DataSource(Config, [Query="SELECT DISTINCT#(lf)sys_ObjectId as ID, Name#(lf)FROM Category"])
in
Source
but then I can't plan a refresh since the datasource "can't be build".
So can I use a template and then change my source ?
5 Replies
- Greg_Deckler
Community Champion
Are you using Power Query Parameters? If not, that is what you should be doing. https://docs.microsoft.com/en-us/power-query/power-query-query-parameters
- AnonymousNot applicable
I do use query parameters, but I cannot use them for building a OLE DB connection string
- v-yuta-msft
Community Support
Anonymous ,
I would suggest you refer to the similar case and blog below:
https://community.powerbi.com/t5/Desktop/How-to-make-a-oledb-connection/td-p/24990
https://pisquare.osisoft.com/thread/39809-pi-oledb-and-power-bi-connection-string
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi Jimmy
Thanks for your reply. To rephrase what I have wich works perfectly well:
let StringCon = "provider=QOle.6.6.3.37;mode=Read;initial catalog='catalog';data source=tcp://server:25780/QEF/Instance", Source1 = OleDb.DataSource(StringCon, [Query="SELECT Id, Name FROM Category"]), Source2 = OleDb.DataSource("provider=QOle.6.6.3.37;mode=Read;initial catalog='catalog';data source=tcp://server:25780/QEF/Instance", [Query="SELECT Id, Name FROM Category"]) in Source2The thing is this Source1 - unlike Source2 - is not "buildable", there is no wheel icon on the right :
This means I cannot build a gateway on Power BI service.
- v-yuta-msft
Community Support
Anonymous ,
I would suggest you create a support ticket here for further analysis.
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.