Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
namratapawale
Frequent Visitor

Enter function parameter values in between function calls in custom data connector during execution

Hi all,

I have a use case where I want to ask user to enter the data source name (existing power BI provided data sources) to connect to and then subsequently retrieve the input values for that data source in another function call and so on process that data further using custom logic ( like mask sensitive information) .. 

For example:

 

 

// This file contains your Data Connector logic
section SampleConnector;

[DataSource.Kind="SampleConnector", Publish="SampleConnector.Publish"]
shared SampleConnector.Contents = (DataSourceName as text) as any =>
let
Source = if (DataSourceName = "HDFS") then
SampleConnector.HDFS()
else
"Unknown"
in
Source;

[DataSource.Kind="SampleConnector", Publish="SampleConnector.Publish2"]
shared SampleConnector.HDFS= (ServerName as text) as any =>
let
Files = Hdfs.Files(ServerName)
in
Files;

....... more functions.....

 

Is there a way to achieve this?

 

 

2 REPLIES 2
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @namratapawale,

 

We can write several functions like below. Then we can call them. But it seems the data sources are limited for now. Please refer to docs/m-extensions.md#data-source-functions.

// This file contains your Data Connector logic
section PQExtension1;

[DataSource.Kind="PQExtension1", Publish="PQExtension1.Publish"]
shared PQExtension1.Contents = (which as text, url as text, path as text) =>
    let
        result = if (which = "web") then get_from_web(path) else get_from_odata(url)
    in
        result;

Headers=[#"Content-type" = "application/x-www-form-urlencoded",#"Accept" = "application/json"];

get_from_odata = (url as text) => 
	let 
		Source = OData.Feed(url)
	in
		Source;

get_from_web = (path as text) =>
	let 
		content = Web.Contents(path, [Headers = Headers]),
                json = Json.Document(content)
        in
        json;


// Data Source Kind description
PQExtension1 = [
    Authentication = [
        Key = [],
        UsernamePassword = [],
        Windows = [],
        Implicit = []
    ],
    Label = Extension.LoadString("DataSourceLabel")
];

// Data Source UI publishing description
PQExtension1.Publish = [
    Beta = true,
    Category = "Other",
    ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") },
    LearnMoreUrl = "https://powerbi.microsoft.com/",
    SourceImage = PQExtension1.Icons,
    SourceTypeImage = PQExtension1.Icons
];

PQExtension1.Icons = [
    Icon16 = { Extension.Contents("PQExtension116.png"), Extension.Contents("PQExtension120.png"), Extension.Contents("PQExtension124.png"), Extension.Contents("PQExtension132.png") },
    Icon32 = { Extension.Contents("PQExtension132.png"), Extension.Contents("PQExtension140.png"), Extension.Contents("PQExtension148.png"), Extension.Contents("PQExtension164.png") }
];

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-jiascu-msft

Thanks for the reply! 

In the example that you've given you're taking parameters that are required by both the connectors right? 

So incase i wanted to allow 5 data sources which in this case are ODBC data sources (as it can be extensible), will the connector UI make fields appear and disappear based on the input provided? It is possible to have multiple UI's for a connector, such as a next button that'll display the the next set of parameters based on the first input?

 

Regards,

Namrata.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.