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
When I expand the details column, I will have this output
When the Type field has a value