Forum Discussion
Looping thru a table to perform a REST API call with paging
- 6 years ago
General approach is to use Table.AddColumn on your PhishingTests table where you call the fnGetTestResults and get the contents back into the new table cell (as a table in a table). Then you can decide if you just want to combine the values in that column, or do other fancy stuff with it.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyVNJRMlWK1QGxjYFsCwjb2ATINoOwTUBqjJViYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [pst_id = _t, total_pages = _t]), #"Added Custom" = Table.AddColumn(Source, "Content", each fnGetTestResults([pst_id],[total_pages],1)) in #"Added Custom"Are you sure your API calls return JSON pages that an be converted into tables without issue?
- 6 years ago
Thanks lbendlin! What you gave me is what I needed to focus on. Here is what I finally got working:
Add Column -> Invoke Custom Function
Function 1
Function 2
Seems to work great! Thanks again! Hope this helps someone else...
Thanks lbendlin! What you gave me is what I needed to focus on. Here is what I finally got working:
Add Column -> Invoke Custom Function
Function 1
Function 2
Seems to work great! Thanks again! Hope this helps someone else...
By the way,
List.Combine({results,{testResults}})
is a bit rich. You should be able to write:
results & testResults
to get the same output.