Forum Discussion
rbreneman
Helper II
4 years agoLooping M code function for ServiceNow API
Hi! I'm hoping someone can help me. I feel like I'm close and I've seen lots of information online about this I just can't seem to get the right combination or syntax. I have a function built and...
- 4 years ago
Disregard. I found a solution!
Here is my working table query:
let Source = List.Generate( () => [Offset = 10000, x = function_user(0)], each not List.IsEmpty( [x][result] ), each [offset = [Offset] + 10000, x = function_user([Offset]) ], each [x] ) in SourceThis video and article were a huge help: https://gorilla.bi/power-query/list-generate-api-calls/, https://www.youtube.com/watch?v=a_RJzoj1cnM.
Hopefully this helps someone else!
rbreneman
Helper II
4 years agoDisregard. I found a solution!
Here is my working table query:
let
Source = List.Generate(
() => [Offset = 10000, x = function_user(0)],
each not List.IsEmpty( [x][result] ),
each [offset = [Offset] + 10000, x = function_user([Offset]) ],
each [x]
)
in
Source
This video and article were a huge help: https://gorilla.bi/power-query/list-generate-api-calls/, https://www.youtube.com/watch?v=a_RJzoj1cnM.
Hopefully this helps someone else!
njglen
4 years agoNew Member
Just a correction in table Query:
let
Source = List.Generate(
() => [Offset = 10000, x = function_user(0)],
each not List.IsEmpty( [x][result] ),
each [Offset = [Offset] + 10000, x = function_user([Offset]) ],
each [x]
)
in
Source
Capital O in the 5th line for the first Offset --> each [Offset = [Offset]
This rbreneman for this it works really well for my ServiceNow report.