Forum Discussion
Parameterize sql query programatically
Let me explain it better.
1. I have a PBIT file which contains a query. This PBIT file is created using the Standalone Power BI Desktop. This query fetches the records from the SQL Server table based on the ProductVersion.
2. ProductVersion is now the parameterized field for me in the query and the input to the ProductVersion will change whenever needed. The query is like "Select * from ProductData where ProductVersion = '"&ProductVersion&"'
3. Once I invoke the PBIT file I will get the below dialog.
4. In the ProductVersion I can manualy input the value as 1001 and click Load and the data/visualization gets loaded.
5. I am using the data Connectivity mode as "Import".
My requirement:
In another C# program I need to read the SQL Server tables and check for the version no '1001' and store it in a variable. I can do this.
1. Using Power BI APIs or any other process/technique I need to pass the Value '1001 from the variable silently to the Power BI query mentioned in Step 2. I am looking for help or idea on how to achieve this.
All this I need to do in the Power BI Desktop only.
Any clue or solution for the above?