Quantcast
Channel: Power Query topics
Viewing all articles
Browse latest Browse all 31059

Strange behaviour when connection to a REST Api

$
0
0

I experienced some strange behaviour, fetching data from a REST Api resource. The resource is using cursor based pagination so I created to functions, GetPage and GetNumberOfPages to create a list of all necessary URL's. Then I created another function GetDetails, to get the full details from each order which needs to be fetched from another resource. 

 

The following snippet of code fetches the URL's, loop through theese pages to get all orderID's, and then fetch order details for all orderID's

 

let

    List = List.Generate( ()=>

        [i=0, ResList = GetPage(UrlSalesOrderLink)],

        each [i] < GetNumberOfPages(),

        each [i=[i]+1, ResList = GetPage([ResList][Next])],

        each [ResList][Data]),

 

    Convert=Table.FromList(List,Splitter.SplitByNothing()),

    Expand = Table.ExpandListColumn(Convert, "Column1"),

    Rename = Table.RenameColumns(Expand,{{"Column1", "Link"}}),

    Details = Table.AddColumn(Rename,"Details",each GetDetails([Link]))

in  Details

 

The code gives the following output

 

output1.png

 

When I expand the details column, I will have this output

 

output2.png

 

When the Type field has a value


Viewing all articles
Browse latest Browse all 31059

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>