Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have the below code:
Pages = List.Generate(() =>
CallAPI(endpoint, "1"),
each HasContToken(Value.Metadata(_)),
each try CallAPI(
endpoint,
Text.Split(Text.Split(Value.Metadata(_)[next_page], "?page="){1}, "&"){0}
)
otherwise null
),
I know the condition step is checking if certain metadata exists. That works well for my final query. But for testing purposes, I don't want it to loop until the check for metadata returns false. I just want it to loop say x amount of times and then finish.
I tried changing the condition to each _ <10 but it just spins at evaluating when executing.
Hi there,
Try something along these lines:
Pages = List.Generate(
() => [APIResult = CallAPI(endpoint, "1"), Counter = 1],
each [Counter] < 10,
each
[
APIResult =
try CallAPI(
endpoint,
Text.Split(Text.Split(Value.Metadata([APIResult])[next_page], "?page="){1}, "&"){0}
)
otherwise null,
Counter = [Counter] + 1
],
each [APIResult]
),
Hopefully the above works and I haven't made syntax errors!
Regards,
Owen
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
101 | |
78 | |
70 | |
63 |
User | Count |
---|---|
141 | |
106 | |
101 | |
85 | |
72 |