Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi Guys,
I am getting a "token literal expected" error in my I-Fetchpages query and am not sure how to deal with it. I am calling a web api and trying to write a do while loop.
Here are the two queries:
I-Fetchpage Query
(startAs as number) as table=>
let
contents = Web.Contents("https://jira.vitalityservicing.com/rest/api/latest/search?jql=project%20=%20VA%20AND%20issuetype%20i..."
& Number.ToText(startAs)),
json = Json.Document(contents),
Value = json[issues],
table = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
table
I-Fetchpages Query
= let
GeneratedList =
List.Generate(
()=> [Result = try i-FetchPage(1) otherwise null, startAt = 0],
each [Result] <> null,
each [Result = try FetchPage([startAt]+51) otherwise null, startAt =([startAt]+51),
each [Result]),
in
GeneratedList
Hi Lydia,
Thank you for the help. I applied your changes and a few of my own. The query was great and I get my results however that the while loop is not terminating when it is null and pardon the pun I am stuck in a loop: )
Here are the queries with your changes and a few of mine:
Query 1 - iFetchpage
(startAs as number) =>
let
contents = Web.Contents("https://jira.vitalityservicing.com/rest/api/latest/search?jql=project%20%3D%20VA%20AND%20issuetype%2..."
& Number.ToText(startAs)),
json = Json.Document(contents),
issues = json[issues]
in
issues
Query 2 - iFetchpages
let
iFetchpages = List.Generate(
()=> [Result = try iFetchpage(1) otherwise null, startAt = 0],
each [Result] <> null,
each [Result = try iFetchpage([startAt]+51) otherwise null, startAt = [startAt]+51],
each [Result]),
toTable = Table.FromList(iFetchpages, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
level1 = Table.ExpandListColumn(toTable, "Column1")
in
level1
Thanks again for the assistant.
Kind regards
Imraan
@Imraan,
Do you get the above error in Advanced Editor? If so, when you click show error after the error message, which syntax does Power Query lead you to?
In your I-Fetchpages Query, it seems that there is an extra comma after "each [Result]),", change your code to the following and check if the error goes away,
= let GeneratedList = List.Generate( ()=> [Result = try i-FetchPage(1) otherwise null, startAt = 0], each [Result] <> null, each [Result = try FetchPage([startAt]+51) otherwise null, startAt =([startAt]+51), each [Result]) in GeneratedList
Regards,
Lydia
User | Count |
---|---|
125 | |
106 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |