Forum Discussion
how to create a query that paginates?
This article contains of very good explanation of how List.Generate works: http://blog.crossjoin.co.uk/2014/06/25/using-list-generate-to-make-multiple-replacements-of-words-in-text-in-power-query/
EDIT: I posted this to the wrong thread(!). I should have replied here, and I'll continue and close the thread there.
Thanks ImkeF
My apologies for taking so long to acknowledge your support. I've finally got around to having a go at List.Generate() and I reckon that I'm on the right path. However, I think that I've created an infinite loop and thus launch a small-scale DoS attack against the Web API I'm trying to hit :-)
Would you mind taking a look at my query text and giving me your opinion? When I run it, I receive no errors, but the query appears to run forever. At this point all that I'm trying to do is generate a list of URIs where I supply the first, and generate the rest based on the initial return.
let
URIList = List.Generate(
()=> [SourceURI="https://api.dovico.com/TimeEntries/?version=5"],
each Text.PositionOf([SourceURI],"N/A") = -1,
each [
Source = Web.Contents([SourceURI],[Headers=[#"Authorization"="WRAP access_token=""client=XXX&user_token=YYY"""]]),
ImportedXML = Xml.Tables(Source,null,1252),
ChangedType = Table.TransformColumnTypes(ImportedXML,{{"PrevPageURI", type text