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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
wataruf
Regular Visitor

I want to use multiple values registered in the list as URL

I created a list called "MessageID_List".

キャプチャ.PNG

I use Web.Contents () to get data from the target URL.

There are multiple target pages.
I want to use the value in "MessageID_List" as part of the URL.

How can I achieve this using Power Query?

キャプチャ2.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @wataruf ,

 

This is the function that makes an https call:

(PageNum as text)=>
let
    Source = Web.Page(Web.Contents("https://eddb.io/commodity/" & PageNum, [Timeout=#duration(0, 0, 1, 0)])),
    #"Filtered Rows" = Table.SelectRows(Source, each ([Id] = "table-stations-min-buy")),
    Data = if Table.RowCount(#"Filtered Rows") > 0 then  #"Filtered Rows"{0}[Data] else  null
in
    Data

 

You need to modify it to your scenario: replace everything after "=>" with the code on your screenshot and then change [XXXX] on your screenshot to PageNum.

 

This is how it is called (assuming the query/function name above is Query2😞

let
    Source = MeddageID_List, //this referes to your parameters list converted to a table on the next step
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each Query2(Text.From([Column1])))
in
   #"Added Custom"

An output of the above will be your list with Tables in the column Custom. You will need to expand it to get the actual content retrieved by Web.Content inside the Query2 function.

 

Hope this helps.

 

Kind regards,

John

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thank you for your quick response.

I read the thread that taught you.
However, I didn't know how to use this content for my request.
I will learn what the functions used in the threads mean.

Anonymous
Not applicable

Hi @wataruf ,

 

This is the function that makes an https call:

(PageNum as text)=>
let
    Source = Web.Page(Web.Contents("https://eddb.io/commodity/" & PageNum, [Timeout=#duration(0, 0, 1, 0)])),
    #"Filtered Rows" = Table.SelectRows(Source, each ([Id] = "table-stations-min-buy")),
    Data = if Table.RowCount(#"Filtered Rows") > 0 then  #"Filtered Rows"{0}[Data] else  null
in
    Data

 

You need to modify it to your scenario: replace everything after "=>" with the code on your screenshot and then change [XXXX] on your screenshot to PageNum.

 

This is how it is called (assuming the query/function name above is Query2😞

let
    Source = MeddageID_List, //this referes to your parameters list converted to a table on the next step
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each Query2(Text.From([Column1])))
in
   #"Added Custom"

An output of the above will be your list with Tables in the column Custom. You will need to expand it to get the actual content retrieved by Web.Content inside the Query2 function.

 

Hope this helps.

 

Kind regards,

John

 

 

It worked perfectly.
Thank you very much for helping me.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors