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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
theRealBaccata
Frequent Visitor

Chaining multi tier UIs

Hello,

 

I'm developing a Power BI connector which queries some api endpoints. The api endpoints are defined in multiple json files. The first input parameter shall take a url to a json file. In the next step a second input parameter is populated based on the first selection as a dropdown. To do so, I'd like to create two UI popups before calculating and showing the results in Power BI.

 

With this documentation https://docs.microsoft.com/en-us/power-query/handlingdocumentation it's a piece of cake to create a UI. However I fail miserably trying to chain both UIs together. I'm able to pass the values from the first UI to the second, however I only see the first UI. The second function isn't invoked and is only shown as a function info. It's still working but as the documentation suggests it's a better user experience showing a UI popup. I also prefer using a multiline multiselect UI in order to query multiple endpoints at once.

 

Is there any way to achieve my idea? It looks like it's support in Power Query given the fact, that querying a SQL Server also chains UI input fields together (first step: select database, second step: select table in database).

 

Here is my code:

 

 

 

 

[DataSource.Kind="Connector", Publish="Connector.Publish"]
shared Connector.Contents = Value.ReplaceType(FirstImpl, FirstType);

FirstType = type function(
    url as (type text meta [
        Documentation.Name = "text",
        Documentation.FieldCaption = "Enter json schema url",
        Documentation.FieldDescription = "Please enter a url to a json schema file.",
        Documentation.SampleValues = {"https://path.to.json.url.com/swagger/v1/swagger.json"}
        ]))
    as text;

FirstImpl = (url as text) => 
    let
        urls = // Create urls...
        result = Value.ReplaceType(SecondImpl, SecondType(urls))
    in
        result;

SecondType = (uris as list) => type function(
    url as (type text meta [
        Documentation.Name = "text",
        Documentation.FieldCaption = "Choose url",
        Documentation.FieldDescription = "Please choose a url from the list below to query.",
        Documentation.SampleValues = {"https://path.to.api.com/api/"},
        Documentation.AllowedValues = uris,
        Formatting.IsMultiLine = true
        ])) as table;

SecondImpl = (url as text) =>
    let
        result = // Query and parse API passed as url
    in
        result as table;

 

 

 

 

 

2 REPLIES 2
v-yiruan-msft
Community Support
Community Support

Hi @theRealBaccata ,

Do you want to generate some UIs similar to cascading drop-down lists? And when selecting the first UI, the second UI should display the corresponding value base on the selected value of first UI? Please review the content in the following blog, hope it can help you.

Specifying Allowed Values, Sample Values and Descriptions For Function Parameters In Power Query

Best Regards

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


@v-yiruan-msft wrote:

Do you want to generate some UIs similar to cascading drop-down lists? And when selecting the first UI, the second UI should display the corresponding value base on the selected value of first UI?


Precisely, please have a look at the build in query for SQL Server. The first UI lets one enter a database and the second UI lists all tables of the database of the first step.

 

I'm trying to achieve a similar behaviour. The first UI lets one enter an arbitrary url to a json file and the second UI displays all api endpoints from this json file.

 

I'm still struggling to invoke a UI within or after another UI.

 


@v-yiruan-msft wrote:

Please review the content in the following blog, hope it can help you.

Specifying Allowed Values, Sample Values and Descriptions For Function Parameters In Power Query


It's an interesting blog post, however I failed to achieve an UI invocation from this code - there is no inoke button.

 

Kind regards

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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