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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Beginna
New Member

Custom Connector Dynamic Parameters

Hello,

I am developing a custom connector.
Is there a way to dynamically generate the parameters that a user selects?
Specifically, I want to identify which table is selected in the navigator and query database parameters on this basis. However, the number and names of the database parameters are dependent on the table name and can be queried using a native query.

Thank you very much!

6 REPLIES 6
Beginna
New Member

@Greg_Deckler does this Help you? Basically the number of the Parameters of a function should be dependent of the selected view in the navigator

@Beginna Right, so when populating the "Data" portion of your navigation table, you should know the table name so you could create a function for getting the data that passed the table name into the function as a parameter and then based on that table name you would know how many parameters to use when retrieving the data. It seems somewhat similar to this from The Definitive Guide to Power Query (M):

 

Note that I get the guilds (tables in your case) and then for the data for that guild/table I then call a function with, in this case the id of the guild (table name in your case). That function then uses the information build the correct API string to execute. In your case, you would know how many parameters to use.

TDGTPQM_Discord.MemberNavigation = () as table =>
    // Navigation
    //** Membership Navigation
    let
        servers = Table.ExpandRecordColumn(TDGTPQM_Discord.GetGuilds(), "Column1", {"name", "id"}, {"Name", "Key"}),
        addDataColumn = Table.AddColumn(servers, "Data", each TDGTPQM_Discord.GetGuildMember([Key])),
        addItemKindColumn = Table.AddColumn(addDataColumn, "ItemKind", each "Record"),
        addItemNameColumn = Table.AddColumn(addItemKindColumn, "ItemName", each "Function"),
        addIsLeafColumn = Table.AddColumn(addItemNameColumn, "IsLeaf", each true),

        Navigation = Table.ToNavigationTable(addIsLeafColumn, {"Key"}, "Name", "Data", "ItemKind", "ItemName", "IsLeaf")       
 
    in
        Navigation;


// ** Member User
TDGTPQM_Discord.GetGuildMember = (guildid as text) as table =>
    let
        apiCall = Json.Document(
            Web.Contents(
                api_uri,
                [
                    RelativePath = "users/@me/guilds/" & guildid & "/member"
                ]
            )
        ),
        output = Table.FromRecords({apiCall})
    in
        output;

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

Hello,

thanks for the answer.
But unfortunately I still don't understand the last step.
If I now have the number, types etc. of the database parameters, how can I have them entered by the user? Especially if the number of parameters per database table is different?
Sorry, I am completely new to this topic.

@Beginna I'll have to test it out but I don't believe you can surface prompting from the user in that circumstance. I've only gotten that to work when initially firing up a connector, when you initially connect that is. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@Beginna So this sounds possible but not sure I have enough information to provide specific help. Can you provide an example of a native query that gets these parameters? And then once you have the parameters, how do you use them?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

I get the parameters for the TEST_VIEW view in the TEST schema via the native query:
Value.NativeQuery(Source, ‘SELECT SCHEMA_NAME, OBJECT_NAME, PARAMETER_NAME, IS_MANDATORY, DEFAULT_VALUE FROM SYS.CS_VIEW_PARAMETERS WHERE SCHEMA_NAME = “TEST” AND OBJECT_NAME = “TEST_VIEW”;’)

If the parameter IP_2 has the value 2, you can use this when querying the TEST_VIEW view:
b = Value.NativeQuery(Source, ‘SELECT * FROM TEST.TEST_VIEW (placeholder.$$IP_2$$=>2);’)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors