Forum Discussion
Dataflow parameter code addition to the source line
I have a dataflow that uses Starburst ODBC. The parameter was created using a list. The list includes 2 different data sources. Having trouble changing the source line in Advanced Editor to accomodate the parameter instead of the hard coded data source.
Here is an example of the current:
From searching the interwebs it appears the first line should be changed to contain the name of the parameter, which is "Starburst Data Source", but I cannot get it to work.
Hi biguy34965,
Thank you for reaching out to the Microsoft fabric community forum.
I understand you are trying to make your dataflow more dynamic by using a parameter instead of hardcoding the Starburst data source in the Advanced Editor. You are on the right track just a small step is needed to get it working.
The StarburstPresto.Contents() function expects a single text value (like a server name), but your parameter "Starburst Data Source" is a list. So, before using it in the function, you need to pick one item from that list.
Update your M code like this:let SelectedSource = #"Starburst Data Source"{0}, Source = StarburstPresto.Contents(SelectedSource, 443, null), #"Navigation 1" = Source{[Name = "thedatabasename", Kind = "Database"]}[Data], #"Navigation 2" = #"Navigation 1"{[Name = "the schemaname", Kind = "Schema"]}[Data], #"Navigation 3" = #"Navigation 2"{[Name = "thetablename", Kind = "Table"]}[Data] in #"Navigation 3"You can change (0) to (1) if you want to use the second data source in the list.
Make sure your parameter is defined as a list of text values. If you want users to choose the source dynamically (like from a dropdown), consider using a text parameter instead of a list, or create a helper query to select the item.Also, please refer to the below mentioned documentation link for more information:
Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn
Parameters - Power Query | Microsoft LearnHope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.
Thank you for using the Microsoft Fabric Community Forum.
2 Replies
- v-kpoloju-msft
Community Support
Hi biguy34965,
Thank you for reaching out to the Microsoft fabric community forum.
I understand you are trying to make your dataflow more dynamic by using a parameter instead of hardcoding the Starburst data source in the Advanced Editor. You are on the right track just a small step is needed to get it working.
The StarburstPresto.Contents() function expects a single text value (like a server name), but your parameter "Starburst Data Source" is a list. So, before using it in the function, you need to pick one item from that list.
Update your M code like this:let SelectedSource = #"Starburst Data Source"{0}, Source = StarburstPresto.Contents(SelectedSource, 443, null), #"Navigation 1" = Source{[Name = "thedatabasename", Kind = "Database"]}[Data], #"Navigation 2" = #"Navigation 1"{[Name = "the schemaname", Kind = "Schema"]}[Data], #"Navigation 3" = #"Navigation 2"{[Name = "thetablename", Kind = "Table"]}[Data] in #"Navigation 3"You can change (0) to (1) if you want to use the second data source in the list.
Make sure your parameter is defined as a list of text values. If you want users to choose the source dynamically (like from a dropdown), consider using a text parameter instead of a list, or create a helper query to select the item.Also, please refer to the below mentioned documentation link for more information:
Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn
Parameters - Power Query | Microsoft LearnHope this helps clarify things and let me know what you find after giving these steps a try happy to help you investigate this further.
Thank you for using the Microsoft Fabric Community Forum.- biguy34965Frequent Visitor
Thanks very much! Very helpful. In the documentation, it seems to favor reports (report screens) to show functionality - rather than dataflows. It could just be me. 🙂